Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void GCD (int a , int b )
- {
- int c ;
- c = a % b ;
- if (b == 1 || c == 1)
- printf ("1\n");
- else if (c == 0)
- printf ("%d\n",b);
- else
- GCD (b, c);
- }
- int main()
- {
- int x, y ;
- while(scanf("%d %d", &x, &y)!= EOF)
- {
- if (x > y && y > 0)
- GCD (x, y) ;
- else if (x < y && x > 0)
- GCD (y, x) ;
- else if (x == y && y > 0)
- printf ("%d\n",x);
- }
- return 0 ;
- }
Add Comment
Please, Sign In to add comment