Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

DS || Pgm 1 || Program to find GCD using recursive function

 #include<stdio.h>

int gcd(int a, int b)

{

if (b == 0)

return a;

return gcd(b, a % b);

}

int main()

{

int a,b;

Printf(“Enter the values of a and b\n”);

Scanf(“%d %d”,&a,&b);

printf("GCD of %d and %d is %d ", a, b, gcd(a, b));

return 0;

}

Post a Comment

0 Comments