返回列表 發帖
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int x,y, tmp;
  6.     cout<<"Enter two random whole numbers: ";
  7.     cin>>x>>y;
  8.    
  9.     cout<<x<<"&"<<y<<"'s greatest common factor: ";
  10.     while(x%y!=0)
  11.     {
  12.      tmp=x%y;
  13.      x=y;
  14.      y=tmp;
  15.      }
  16.      cout<<y<<endl<<endl;
  17.                       system("pause");
  18.                       return 0;
  19. }
複製代碼

TOP

返回列表