#include<iostream>
using namespace std;
int GCD(int x,int y)
{
if(x==y)
{
return x;
}
else if(x%y==0)
{
return y;
}
else if(y%x==0)
{
return x;
}
else if(x>y)
{
return (GCD(x%y,y));
}
else
{
return(GCD(x,y%x));
}
}
int main(){
int a, b;
cout<<"Enter two numbersn";
cin>>a>>b;
int x=GCD(a,b);
cout<<"GREATEST COMMON DiVISIOR IS :"<<x;
return 0;
}
0 Comments