#include "stdafx.h" #include <iostream> using namespace std; int main() { int a, b, c, i; cout << "请输入两个数:"; cin >> a; cin >> b; for (i = a; i>1; i--) { if (a%i == 0 && b%i == 0) { cout << a << "和" << b << "的最大公约数是:" << i << endl; } break; } getchar(); return 0; }
时间: 2024-10-05 05:31:47