fork download
  1. #include <stdio.h>
  2. int MCD(int m, int n);
  3. int main(void) {
  4. // your code goes here
  5. int m;
  6. int n;
  7. int res;
  8. int resto;
  9. scanf("%d", &m);
  10. printf("il primo numero è: %d \n", m);
  11. scanf("%d", &n);
  12. printf("IL secondo numero è: %d \n", n);
  13. if(m<n){
  14. printf("error");
  15. }
  16. if(resto==0){
  17. res= MCD(m, n);
  18. printf("il MCD è: %d \n", n);
  19. }
  20. else{
  21. resto=MCD(m, n);
  22. printf("il resto è: %d \n", resto);
  23. }
  24. return 0;
  25. }
  26.  
  27. int MCD(int m, int n){
  28. int resto;
  29. int res;
  30. if(resto==0){
  31. res=n;
  32. }
  33. else{
  34. resto= m % n;
  35. printf("il resto è: %d \n", resto);
  36. }
  37. return 1;
  38. }
  39.  
Success #stdin #stdout 0s 5316KB
stdin
20
6
stdout
il primo numero è: 20 
IL secondo numero è: 6 
il MCD è: 6