#include using namespace std;

int gcd(int m, int n) { while(n!=0) { int temp = m % n; m = n; n = temp; } return m; }

int main() { int m, n; cout << "输入两个正整数m和n: "; cin >> m >> n; int result = gcd(m, n); cout << "最大公约数是: " << result << endl; return 0; }

输入两个正整数m和n求它们的最大公约数c++

原文地址: https://www.cveoy.top/t/topic/h008 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录