write a do while loop in C++ to display 2,4,6,8,....20..?

2015-09-29 6:00 pm

回答 (2)

2015-09-29 6:23 pm
#include <iostream>
using namespace std;
int main()
{

int i = 2;

do
{
cout << i << " ";
i +=2;
}while(i <= 20);

cout << endl;

return 0;
}
2015-09-29 6:22 pm
int j=2;
do{
cout << j;
j+=2;
}while(j<=20);


收錄日期: 2021-04-21 14:25:49
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20150929100049AA9foBB

檢視 Wayback Machine 備份