+ 4
How does the modulus operator work on negative numbers?
3 Respostas
+ 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