Run ID:94785

提交时间:2024-10-26 13:27:25

#include <bits/stdc++.h> using namespace std; int main (){ int a,b,f; cout<<"请输入第一个正整数:"; cin>>a; cout<<"请输入第二个正整数:"; cin>>b; f=(a<b)?a:b; while(f>0){ if(a%f==0&&b%f==0){ break; } f--; } cout<<"最大公约数:"<<f<<endl; return 0; }