fork download
  1. #include <stdio.h>
  2.  
  3. int gcd(int m, int n){
  4. if(n == 0){
  5. return m;
  6. }else{
  7. return gcd(n, m % n);
  8. }
  9. }
  10.  
  11. int main(void){
  12. int a, b;
  13.  
  14. scanf("%d,%d", &a, &b);
  15.  
  16. if(a >= b){
  17. printf("%d\n", gcd(a, b));
  18. }else{
  19. printf("%d\n", gcd(b, a));
  20. }
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 5316KB
stdin
40,5
stdout
5