返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a=0,b=0,r=0;
  7.     cout<<"請輸入一整數: ";
  8.     cin>>a;
  9.     b=1000/a;
  10.     for(int i=1;i<=b;i++)
  11.         for(int j=1;j<=i;j++)
  12.             r=r+a;
  13.     cout<<"1~1000所有"<<a<<"的倍數為: "<<r<<endl;   
  14.     system("pause");
  15.     return 0;   
  16. }
複製代碼

TOP

返回列表