07_gcd.c 228 B

1234567891011121314151617
  1. #include <stdio.h>
  2. int gcd(int a, int b)
  3. {
  4. if (b == 0)
  5. return a;
  6. else
  7. return gcd(b, a % b);
  8. }
  9. int main()
  10. {
  11. int a = 10;
  12. int b = 15;
  13. printf("Greatest common divisor of %d and %d is %d\n", a, b, gcd(a, b));
  14. return 0;
  15. }