0

Program using while statement to generate the following sequence 1,6,11,16,21.....101

while statement

9th Mar 2018, 2:12 PM
coral
3 Réponses
+ 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; }
9th Mar 2018, 2:22 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
thats c#
9th Mar 2018, 2:23 PM
Tiger Jones
Tiger Jones - avatar
+ 1
You just have to increment a counter begining at one every loop cycle and then print the counter.
9th Mar 2018, 2:19 PM
Tiger Jones
Tiger Jones - avatar