Question 5
Back to Exercise
How many times does the body of for (int i = 0; i < 10; i += 3) run?
- A 3
- B 4 Correct
- C 10
- D 9
Correct Answer: Option B
i takes the values 0, 3, 6 and 9; the next value, 12, fails the test. That is 4 passes – ⌈10 / 3⌉.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!