返回列表 發帖
本帖最後由 t3742238 於 2011-11-26 16:58 編輯
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int a,c=0;
  6.     cout<<"請輸入一個因數";
  7.     cin>>a;
  8.     cout<<a<<"的因數有因數" ;
  9.    
  10.     for(int i=1; i<=a; i++)
  11.     {
  12.         if(a%i==0)
  13.         {
  14.                cout<<i<<" ";
  15.                c++;
  16.         }
  17.     }
  18.     cout<<"共有"<<c<<"個因數";
  19.     system("pause");
  20.     return 0;
  21. }
複製代碼

TOP

返回列表