1. What are Loops?


2. for Loop

for (init; condition; update) {
    // code
}

Example:

for (int i = 0; i < 5; i++) {
    cout << i << " ";
} /* Output in this case: 0 1 2 3 4 */

3. while Loop

while (condition) {
    // code
}

4. do-while Loop

do {
    // code
} while (condition);