for Loops

AP Computer Science A· difficulty 3/5

Best loop to sum even numbers from 0 to 20

  • A

    while (i < 20)

  • B

    for (int i = 1; i <= 20; i += 2)

  • C

    for (int i = 0; i <= 20; i++)

  • D

    for (int i = 0; i <= 20; i += 2)

    check_circle

Explanation

Step by 2 starting from 0.

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

Related questions