Guest User

Untitled

a guest
Feb 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void GCD (int a , int b )
  5. {
  6. int c ;
  7. c = a % b ;
  8. if (b == 1 || c == 1)
  9. printf ("1\n");
  10. else if (c == 0)
  11. printf ("%d\n",b);
  12. else
  13. GCD (b, c);
  14. }
  15.  
  16.  
  17. int main()
  18. {
  19. int x, y ;
  20. while(scanf("%d %d", &x, &y)!= EOF)
  21. {
  22. if (x > y && y > 0)
  23. GCD (x, y) ;
  24. else if (x < y && x > 0)
  25. GCD (y, x) ;
  26. else if (x == y && y > 0)
  27. printf ("%d\n",x);
  28. }
  29. return 0 ;
  30. }
Add Comment
Please, Sign In to add comment