It seems like there is a difference in modulo operator answers depending on a programming language. For example, c++
, c
, and Java
all return -1 for an expression like -5%2
while python3.x
outputs 1 for the same calculation. Why is this the case?
Edit: mistakenly wrote -10%2 instead of -5%2.