+ 4
How does the modulus operator work on negative numbers?
4 Answers
+ 6
Seb TheS
đđ˘đ˘đđ¨ đđĄđđ˛đđĽ
Thanks, guys. It really helps.
Abhay
Bro, not everything can be found on solo experiments, right?
I figured out how floor division works on negative numbers but I couldn't figure out how % works. So I chose to ask.
+ 2
When b is negative:
a % b = c
Then:
b < c <= 0
c = a - n*b
(n can be any whole number)
- 1
M Tamim find ur ans by Tryiny it on code playground