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


  17. }
  18. cout<<op<<endl;
  19.    cout<<endl;
  20. goto re;

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

  23. }
複製代碼

TOP

返回列表