返回列表 發帖
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.         int h;
  7.         int j = 0;
  8.     cout << "請輸入一個數字";
  9.     cin >> h;
  10.     cout << h << " 的因數有";
  11.     for (int i = 1; i <= h; i++)
  12.     {
  13.             if (h % i == 0)
  14.             {
  15.                     j++;
  16.             }
  17.     }
  18.         cout << j << "個" << endl;
  19.         system("pause");
  20.         return 0;
  21. }
複製代碼

TOP

返回列表