求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;
}
}
上一篇:html dom
c语言如何用while语句实现辗转相除法
悠哉游哉,辗转...
B、 有若干根长短不一的木材,工人需要将这些木材分割成一样长的小段,编写一个算法计算
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M