Solution: Loop It Up

The main() function uses two for loops, one to print a message repeatedly and another to display even numbers in a sequence.

  • The first for loop initializes i = 0 and runs while i < 5, printing "Looping!" each time and incrementing i by 1.

  • Prints an empty line using cout << endl; to visually separate the outputs.

  • The second for loop starts with i = 0 and increases i by 2 on each iteration (i += 2), printing all even numbers from 0 to 10.

  • Ends with return 0; to signal successful program completion.

Solution: Loop It Up

The main() function uses two for loops, one to print a message repeatedly and another to display even numbers in a sequence.

  • The first for loop initializes i = 0 and runs while i < 5, printing "Looping!" each time and incrementing i by 1.

  • Prints an empty line using cout << endl; to visually separate the outputs.

  • The second for loop starts with i = 0 and increases i by 2 on each iteration (i += 2), printing all even numbers from 0 to 10.

  • Ends with return 0; to signal successful program completion.