返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     oo:
  7.     system("pause");
  8.     system("cls");      
  9.     int x,y,c;
  10.     cout<<"請依序輸入兩個正整數: ";
  11.     cin>>x>>y;
  12.     cout<<x<<","<<y<<"的最大公因數是"<<endl;
  13.     while(x%y!=0)
  14.     {
  15.       c=x%y;           
  16.       x=y;           
  17.       y=c;
  18.     }
  19.     cout<<c<<endl;
  20.     goto oo;
  21.     system("pause");
  22.     return 0;   
  23. }
複製代碼

TOP

返回列表