返回列表 發帖
  1. #include<cstdlib>
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a=0;
  7.     for(int i=333;i<1000;i+=3)
  8.     {
  9.             a=a+i;
  10.     }
  11.     cout<<"333~999間所有3的倍數總和:"<<a<<endl;
  12.     system("pause");
  13.     return 0;
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a;
  7.     cout<<"請問你掉進湖裡的是什麼貓貓(請輸入數字,0=呆若木喵1=銀貓貓,2=金貓貓)";
  8.     cin>>a;
  9.     cout<<"你需要回答:";
  10.     cout<<(a+1)%3<<endl;   
  11.     system("pause");
  12.     return 0;
  13. }
複製代碼

TOP

返回列表