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

  22. }
複製代碼
http://fs-old.mis.kuas.edu.tw/~s1102137106/music/

TOP

返回列表