class ex1
{
int gys1(int m, int n) // 循ç¯å®ç°
{
int k,y;
if(m<n)
{
k=m;
m=n;
n=k;
}
while(m%n!=0)
{
y=m%n;
m=n;
n=y;
}
return n;
}
int gys2(int m,int n)ãã//éå½å®ç°
{
int k,y;
if(m<n)
{
k=m;
m=n;
n=k;
}
y=m%n;
if(y==0)
{
return n;
}
else
{
m=n;
n=y;
return gys2(m,n);
}
}
public static void main(String[] args)
{
ex1 e1=new ex1();
System.out.println(e1.gys1(12,8));
ex1 e2=new ex1();
System.out.println(e1.gys2(12,8));
}
}
温馨提示:答案为网友推荐,仅供参考