#include<iostream.h>
int gcd(int,int);
int main()
{
int a,b;
cout<<"enter 2 number:";
cin>>a>>b;
cout<<"GCD = "<<gcd(a,b)<<"\n";
}
int gcd(int x,int y)
{
int max,min,s,r1,r2;
max=(x>=y) ? x : y;
min=(x<=y) ? x : y;
s=min;
while(r2!=0)
{
r1=max%min;
if(r1==0)
{
r2=s%min;
if(r2==0)
return min;
}
min--;
}
}