0
Program using while statement to generate the following sequence 1,6,11,16,21.....101
while statement
3 Answers
+ 17
#include <iostream>
using namespace std;
int main()
{
int num = 1,number=1;
while (num < 6) {
cout << "Number: " << number << endl;
num++;number+=5;
}
return 0;
}
+ 2
thats c#
+ 1
You just have to increment a counter begining at one every loop cycle and then print the counter.