1 /** 2 * 鷗幾裏得算法,求連個整數的最大公因數 3 */ 4 5 /** 6 * m > n 7 */ 8 9 #include<stdio.h> 10 int maxCommFactor(int m, int n){ 11 12 int men =0; 13 while( n != 0 ) 14 { 15 men = m % n; 16 m = n; 17 n = men; 18 } 19 20 return m; 21 } 22 23 int main() 24 { 25 26 int b = maxCommFactor(50,15); 27 printf("max commmon factor is : %d\n", b ); 28 }