Python and Java remainders compared

Python's % operator uses the floor of a/da/d as the quotient, while Java's % operator truncates the quotient toward zero; both then return a−dqa - dq. For each pair of integers in the table, enter the value that each language returns for a % d. Enter each value as an integer.

adPython a % dJava a % d
296
-296
-426
-16

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Integers and Primes Questions: