返回列表 發帖
  1. #include<iostream>
  2. using namespace std;

  3. int main()
  4. {
  5.     cout<<"請輸入一正整數:";
  6.     int x;
  7.     cin>>x;
  8.     int i=1;
  9.     while(i<=x)
  10.     {
  11.         if(x%i==0)
  12.         {
  13.             cout<<i<<" ";         
  14.         }
  15.         i++;
  16.     }

  17.     system("pause");
  18.     return 0;
  19. }
複製代碼

TOP

返回列表