- (int)maxCommonDivisor:(int)numberA numberB:(int)numberB {
int temp;
while (numberA % numberB > 0) {
temp = numberA % numberB;
numberA = numberB;
numberB = temp;
}
return numberB;
}
- (int)maxCommonDivisor:(int)numberA numberB:(int)numberB {
int temp;
while (numberA % numberB > 0) {
temp = numberA % numberB;
numberA = numberB;
numberB = temp;
}
return numberB;
}
本文标题:辗转相除法(求最大公约数)
本文链接:https://www.haomeiwen.com/subject/ejnttftx.html
网友评论