201111621319
#include <stdio>
using namespace std;
int x,y,z;
//求两个数的最大公约数
public class Testgcd {
private int yueshu=1;
private int gcd(int a,int b)
{
if(a%b==0)
return b;
else
return gcd(b,a%b);
}
public int maincode(int a,int b)
{
if(a>b)
yueshu=gcd(a,b);
else
yueshu=gcd(b,a);
System.out.println(yueshu);
return 0;
}
public static void main(String[] args) {
Testgcd tgcd=new Testgcd();
tgcd.maincode(1,2);
}
}
结果 1