Guest User

Untitled

a guest
Apr 25th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int gcd(int a, int b){ //최대공약수
  5.  
  6.  
  7. if(a==b)
  8. return a;
  9.  
  10.  
  11. else if(a>b)
  12. return(b,a);
  13.  
  14. else
  15. return (b-a,a);
  16.  
  17. }
  18.  
  19.  
  20.  
  21. int main()
  22. {
  23. int a=0;
  24. int b=0;
  25. scanf("%d%d",&a,&b);
  26. printf("%d",gcd(a,b));
  27.  
  28. }
Add Comment
Please, Sign In to add comment