辗转相除法(求最大公约数)

- (int)maxCommonDivisor:(int)numberA numberB:(int)numberB {
    int temp;
    while (numberA % numberB > 0) {
        temp    = numberA % numberB;
        numberA = numberB;
        numberB = temp;
    }
    return numberB;
}

你可能感兴趣的:(辗转相除法(求最大公约数))