Computer Science, asked by vikasroy3757, 1 year ago

C program for finding gcd of given numbers using functions

Answers

Answered by garywalter1221
0

int main() {

   int a, b;

   printf("Enter 2 numbers:");

   scanf("%d%d", & a, & b);

   printf("Greatest Common Divisor is %d", gcd(a, b));

 

   return 0;

}

int gcd(long a, long b) {

 if (b == 0)

   return a;

 else

   return gcd(b, a % b);

}

Similar questions