返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.         while(true)
  7.         {
  8.                 int a, b, c;
  9.                 cout<<"請輸入三個數字:";
  10.                 cin >> a >> b >> c;
  11.                 int max = (a > b) ? a : b;
  12.                 max = (c > max) ? c : max;
  13.                 for(int i = max; i <= a * b * c; i++)
  14.                 {
  15.                         if(i % a == 0 && i % b == 0 && i % c == 0)
  16.                         {
  17.                                 cout << i << endl;
  18.                                 break;
  19.                         }
  20.                 }
  21.                
  22.                 system("pause");
  23.         }
  24.         return 0;
  25. }
複製代碼

TOP

返回列表