C++ 代码实现求两个正整数的最大公约数
#include
int gcd(int a, int b) { int temp; while (b != 0) { temp = a % b; a = b; b = temp; } return a; }
int main() { int m, n; cin >> m >> n; int result = gcd(m, n); cout << result << endl; return 0; }
原文地址: https://www.cveoy.top/t/topic/quJn 著作权归作者所有。请勿转载和采集!