#include
class cons
{
int n,m,t,r;
public:
void getdata();
int cic(int m,int n,int t);
int min(int m,int n);
};
void cons::getdata()
{
cout<<"Enter the two numbers : ";
cin>>m>>n;
t=min(m,n);
t=cic(m,n,t);
if (t!=1)
cout<<"The GCD of two numbers : "<
cout<<"The given two numbers doesn't have GCD value!"<
int cons::min(int m,int n)
{
if (m
else
t=n;
return t;
}
int cons::cic(int m,int n,int t)
{
l10:
r=m%t;
if (r==0)
{
r=n%t;
if (r==0)
return t;
}
t--;
goto l10;
}
void main()
{
clrscr();
cons c;
c.getdata();
getch();
}
No comments:
Post a Comment