LearnFrenzy
Sign in Take a free test

C Loops · Loops MCQ · Question 5

How many times does for (i = 0; i < 10; i += 3) run? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links