How come 7%(-3)=-2? | Sololearn: Learn to code for FREE!

+1

How come 7%(-3)=-2?

1/22/2017 2:25:09 PM

nitesh

4 Answers

New Answer

+1

but i tried it in python2.7 and it give -2.

+1

according to stackexchange: 7/(-3)=-2.3333... floor(-2.3333...)=-3 -3*-3=9 7-9=-2

0

i just tried it and it outputs 1 maybe you used / instead of %

0

if you saw that in a challenge I think it's an error. There are many error on challenges