PROGRAM:
#include<stdio.h>
main()
{
int a,b;
clrscr();
printf("Enter the two numbers\n");
scanf("%d%d",&a,&b);
printf("THE GCD OF %d AND %d IS %d\n",a,b,gcd(a,b));
getch();
}
int gcd(int a,int b)
{
if(b!=0)
{
return (gcd(b,b%a));
}
else
return(a);
}
OUTPUT:
Enter the two numbers
30
45
THE GCD OF 30 AND 45 IS 15
Enter the two numbers
66
99
THE GCD OF 66 AND 99 IS 33
Thank Your Valuable Comment Tool to Insert codes in Comments : Convert My Code. Hide