返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a=0,b,c;
  7.     cout<<"1:";   
  8.     cin>>b;
  9.     cout<<"2:";   
  10.     cin>>c;
  11.     for(int x=b;x>=1;x--)
  12.     {
  13.        if(b%x==0&&c%x==0)
  14.        {
  15.        cout<<x<<" ";
  16.        break;
  17.        }
  18.     }
  19.     system("pause");
  20.     return 0;
  21. }
複製代碼

TOP

返回列表