How many times will the following loop execute? for (int i = 0; i < 5; i++) {
How many times will the following loop execute?
for (int i = 0; i < 5; i++) {
printf("%d ", i);
}
Show answerHide answer
Correct answer: (C) 5
Explanation
i takes values 0, 1, 2, 3, 4; when i becomes 5 the condition i < 5 fails, so the loop executes 5 times.