50+47+44........+2用任一程式選寫
但需要用到迴圈
請用最簡單的方式選寫

 

answer:

#include "stdafx.h"
#include <iostream>

using namespace std;

int main(int argv,char * args[])
{

int start_value ,default_value_end=2;
int total=0;

cout<<"輸入開始值=";
cin>>start_value ;
for(start_value;start_value>=default_value_end;start_value-=3)
{
total+=start_value;
}

cout<<total;

return 0;
}

參考資料 me

 

arrow
arrow
    全站熱搜

    mitblog 發表在 痞客邦 留言(0) 人氣()