Advertisement
Igor2909

mcd di un numero

Feb 12th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main() {
  6.     int a, b, mcd;
  7.     printf("Inserisci a: ");
  8.     scanf("%d", &a);
  9.     printf("Inserisci b: ");
  10.     scanf("%d", &b);
  11.     while (a!=b){
  12.         if(a>b){
  13.             a -=b;
  14.         } else{
  15.             b-=a;
  16.         }
  17.     }
  18.     mcd = a;
  19.     printf("mcd vale : %d", mcd);
  20.     system("PAUSE");
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement