+ 1
/ and %
Modulus operator gives the remainder and the division operator gives the quotient. So how is it possible that:- -16 / -3 = 5 BUT -16 % -3 = -1 According to me, both the answers should have same sign.
2 Respuestas
+ 2
No. Because 5 * -3 is -15 and you need -1 to get to -16, which actually is the remainder of this division
+ 1
Thanks Nikolai.