#include<iostream>
#include<algorithm>
using namespace std;
int gcd(int m,int n)
{
while(n%m!=0)
{
int r=n%m;
n=m;
m=r;
}
return m;
}
int main()
{
int m,n;
cout<<"Enter two numbers"<<endl;
cin>>m>>n;
cout<<gcd(m,n);
return 0;
}
#include<algorithm>
using namespace std;
int gcd(int m,int n)
{
while(n%m!=0)
{
int r=n%m;
n=m;
m=r;
}
return m;
}
int main()
{
int m,n;
cout<<"Enter two numbers"<<endl;
cin>>m>>n;
cout<<gcd(m,n);
return 0;
}
Comments
Post a Comment