While Loop
Definition:
In C++, a while loop is a control flow statement that allows a block of code to be repeatedly executed as long as a specified condition is true.
Example:
// C++ program to Demonstrate while loop #include <iostream> using namespace std; int main() { // initialization expression int i = 1; // test expression while (i < 6) { cout << "Hello World\n"; // update expression i++; } return 0; }
Output