伪代码如下: 123456 Algorithm (integerOne, integerTwo) if (integerOne % integerTwo == 0) result = intergerTwo else result = gcd(integerTwo, integerOne % integerTwo) return result C 代码: 123456789101112131415161718 int (int n1, int n2){ int nOne = fabs(n1); int nTwo = fabs(n2); if (nOne == 0) return nTwo; if (nTwo == 0) return nOne; int result; if (nOne % nTwo == 0) result = nTwo; else result = gcd(nTwo, nOne % nTwo); return result;} 赞微海报分享
近期评论