Expressions and Assignment Statements

AP Computer Science A· difficulty 3/5

To check if <code>int n</code> is even, you can use

  • A

    n % 2 == 0

    check_circle
  • B

    Math.abs(n)

  • C

    n / 2 == 0

  • D

    n == 2

Explanation

Even numbers have remainder 0 when divided by 2.

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

Related questions