for Loops

AP Computer Science A· difficulty 3/5

Output of:

<code>for (int i = 0; i < 10; i += 2) System.out.print(i + " "); </code></pre>

  • A

    2 4 6 8

  • B

    0 2 4 6 8 10

  • C

    0 2 4 6 8

    check_circle
  • D

    Infinite

Explanation

i = 0, 2, 4, 6, 8 (stops because 10 < 10 is false).

Want 10 more like this — adaptive to your weak spots?

Related questions