question 4 0.25 pts what is the output of the following code: for (int i = 0; i < 5; i++) { cout << i << \…

question 4 0.25 pts what is the output of the following code: for (int i = 0; i < 5; i++) { cout << i << \ \; }

question 4 0.25 pts what is the output of the following code: for (int i = 0; i < 5; i++) { cout << i << \ \; }

Answer

Explanation:

Step1: Analyze for - loop start

The for - loop initializes i = 0.

Step2: Check loop condition

The condition i < 5 is true when i = 0, 1, 2, 3, 4. Each time the loop runs, the value of i is printed.

Step3: Increment and repeat

The increment i++ increases i by 1 after each iteration until the condition i < 5 is false.

Answer:

0 1 2 3 4