本文共 427 字,大约阅读时间需要 1 分钟。
#include#include int gcd(int m, int n){ int rem; while(n > 0) { rem = m % n; m = n; n = rem; } return m;}int main(){ int m, n; printf("Please input two numbers: \n"); scanf("%d %d", &m, &n); if(m > n) printf("the max gcd of the two number is: %d\n", gcd(m,n)); else printf("the max gcd of the two number is: %d\n", gcd(n,m)); return 0;}
转载地址:http://mshvb.baihongyu.com/