#include
class euclid
{
int n,m,r;
public:
void getdata();
int eu_alg(int m,int n);
};
void main()
{
clrscr();
euclid e;
e.getdata();
getch();
}
void euclid::getdata()
{
cout<<"Enter the two numbers : ";
cin>>m>>n;
r=eu_alg(m,n);
cout<<"The GCD of the given numbers : "<
int euclid::eu_alg(int m,int n)
{
while(n>1)
{
r=m%n;
m=n;
n=r;
}
return m;
}
No comments:
Post a Comment