Multiple choice

If m = -16 and n = -5 (m and n are int types), the result of the expression m%n is

  1. -1

  2. 1

  3. -3

  4. 3

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In Java, the remainder operator (%) follows the sign of the dividend. Since -16 divided by -5 is 3 with a remainder of -1, the result is -1.