/* maxCommonFactor.c */ /* 最大公因子数 */ #include <stdio.h> int maxCommonFactor(int m, int n); int main(){ int m, n; printf("Enter two integers: "); scanf("%d %d", &m, &n); printf("max common factor: %d\n", maxCommonFactor(m, n)); return 0; } int maxCommonFactor(int m, int n){ int r = m % n; while(r != 0){ m = n; n = r; r = m % n; } return n; }