for Loops

AP Computer Science A· difficulty 2/5

int count = 0;
for (int i = 0; i < 10; i++) {
  count++;
}
System.out.println(count);

What is printed?

  • A

    10

    check_circle
  • B

    9

  • C

    11

  • D

    0

Explanation

The loop iterates while i < 10 starting from 0: i = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 — that's 10 iterations. count is 10.

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

Related questions