Computer Science, asked by aniketb5567, 1 year ago

Write a recursive algorithm to find the GCD of two numbers 5 Marks?

Answers

Answered by Anonymous
0
#include

int gcd_recursive(int a, int b)

{

if (b == 0)

return a;

return gcd_recursive(b, a % b);

}

int main()

{

printf("GCD of 10 and 25: %d\n", gcd_recursive(10, 25));

return 0;

}

$ gcc gcd.c -o gcd

$ ./gcd

GCD of 10 and 25: 5

Similar questions