求2个数的最大公约数 - 轮除法
public class C1{
public int getCommonDivisior(int a, int b){
int temp;
if(a<=b){
temp = b;
b = a;
a = temp;
}
while (b!=0){
temp = a%b; a=b; b = temp;
}
return a;
}
}
求2个数的最大公约数 - 轮除法
public class C1{
public int getCommonDivisior(int a, int b){
int temp;
if(a<=b){
temp = b;
b = a;
a = temp;
}
while (b!=0){
temp = a%b; a=b; b = temp;
}
return a;
}
}