Why -1%26 = -1 in Java and C, and why it is 25 in Python?

c, java, modulo, python

Solution

Python's %-operator calculates the mathematical remainder, not the modulus. The remainder is by definition a number between 0 and the divisor, it doesn't depend on the sign of the dividend like the modulus.

Problem

Why modulo operator is not working as intended in C and Java?

Original source

Related problems