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

TOP

返回列表