#include<stdio.h>
#include<conio.h>
int Gcd(int,int);
void main()
{
int m,n;
clrscr();
printf("Enter the two num :");
scanf("%d %d",&m,&n);
printf("\n Gcd of the %d & %d is = %d",m,n,Gcd(m,n));
getch();
}
int Gcd(int a,int b)
{
if(a==b)
return a;
else
if(a>b)
return Gcd(a-b,b);
else
return Gcd(a,b-a);
}
OUTPUT:
Enter two no :
25 35
GCD of 25 & 35 is 5
#include<conio.h>
int Gcd(int,int);
void main()
{
int m,n;
clrscr();
printf("Enter the two num :");
scanf("%d %d",&m,&n);
printf("\n Gcd of the %d & %d is = %d",m,n,Gcd(m,n));
getch();
}
int Gcd(int a,int b)
{
if(a==b)
return a;
else
if(a>b)
return Gcd(a-b,b);
else
return Gcd(a,b-a);
}
OUTPUT:
Enter two no :
25 35
GCD of 25 & 35 is 5
No comments:
Post a Comment