#include<iostream>
using namespace std;
void GcdFinder ( int a,int b )
{
while ( a!=b )
{
if ( a>b ) {
a=a-b;
}
else {
b=b-a;
}
}
cout<<"GCD Of two numbers is "<<a<<endl;
}
int main()
{
int a,b;
cout<<"Enter two numbers\n";
cin>>a>>b;
GcdFinder ( a,b );
getchar();
return 0;
}
using namespace std;
void GcdFinder ( int a,int b )
{
while ( a!=b )
{
if ( a>b ) {
a=a-b;
}
else {
b=b-a;
}
}
cout<<"GCD Of two numbers is "<<a<<endl;
}
int main()
{
int a,b;
cout<<"Enter two numbers\n";
cin>>a>>b;
GcdFinder ( a,b );
getchar();
return 0;
}
No comments:
Post a Comment