返回列表 發帖
  1. cout<<"請輸入第二個數: ";
複製代碼

TOP

  1. include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int m, n, tmp;
  8.     cout<<"請依序輸入兩個正整數: ";
  9.     cin>>m>>n;
  10.     cout<<a<<"與"<<b<<"的最大公因數為: ";
  11.     while(m%n!=0)
  12.     {
  13.         tmp=m%n;
  14.         m=n;
  15.         n=tmp;
  16.     }
  17.     cout<<n<<endl<<endl;
  18.     goto re;
  19.     system("pause");
  20.     return 0;   
  21. }}
複製代碼

TOP

返回列表