C Program for finding the GCD of two numbers using Recursion
#include<stdio.h>
#include<conio.h>
int hcf(int
a,int b);
void main()
{
int x,y;
clrscr();
printf("Enter Any Two numbers for Find
their GCD\n");
scanf("%d %d",&x,&y);
printf("\nThe GCD is %d",hcf(x,y));
getche();
}
int hcf(int
a,int b)
{
if(a==b)
return a;
else if(a>b)
if(a%b==0)
return b;
else
hcf(a%b,b);
else
if(b%a==0)
return a;
hcf(a,b%a);
}
OUTPUT
------------------------------------------------------------------------------------------------------------
You can also visit:-