返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5. int x,y,bigger,tmp;
  6. re:
  7. cout<<"請依序輸入x,y";
  8. cin>>x>>y;
  9. bigger=x>y?x:y;
  10. cout<<x<<","<<y<<"最小公倍數=";
  11. for(int i=bigger;i<=x*y;i++)
  12. {
  13. if(i%x==0&&i%y==0)
  14. {
  15. tmp=i;
  16. break;

  17. }

  18. }
  19. cout<<tmp;
  20. cout<<endl;
  21. goto re;

  22. system("pause");
  23. return 0;

  24. }
複製代碼

TOP

返回列表