+ 1

C++

How to enter a particular statement n (n with be entered by the user) times using while loop?

29th Nov 2017, 6:28 PM
Lakni Aloka Weerakoon
Lakni Aloka Weerakoon  - avatar
2 Answers
+ 4
#include <iostream> using namespace std; int main() { int n = 0; int i = 0; cout << "Please enter number of loops: \n"; cin >> n; while(i < n) { cout << "A particular statement!\n"; ++i; } return 0; }
29th Nov 2017, 6:33 PM
AgentSmith
0
Tks
30th Nov 2017, 3:00 AM
Lakni Aloka Weerakoon
Lakni Aloka Weerakoon  - avatar