/*2015烟台大学计算机与控制工程学院
*ALL rightreserved.
*文件名称:test.cpp
*作者:陈文浩
*完成日期:2016年3月22日。
*/输入两个数,并求出最大公约数
/*问题及代码:输入两个数,并求出最大公约数
*/
#include <iostream>
using namespace std;
int gcd(int,int);
int main()
{
int a,b,g;
cin>>a>>b;
g=gcd(a,b);
cout<<"最大公约数是: "<<g<<endl;
return 0;
}
int gcd(int x,int y)
{
int r;
while(y>0)
{
r=x%y;
x=y;
y=r;
}
return x;
}
int gcds(int x,int y,int z,int w)
{
int g1,g2,g;
g1=gcd(x,y);
g2=gcd(z,w);
g=gcd(g1,g2);
return g;
}