+ 2

-2%10=8 can someone explain this equation with real life example and can you use this expression in programming

Just stumbled across this equation. Curious about how should i use this expression in a program

9th Sep 2017, 12:39 PM
Ravi Kumar
Ravi Kumar - avatar
5 Respostas
+ 4
Generally, for x%m, where x<0, x%m=m-(-x%m)
9th Sep 2017, 1:46 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
You know -10/10=1, so -10%10=0 Now, apply this: -2%10=(-10+8)%10=0+8%10=8
9th Sep 2017, 1:31 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
Yes. Precisely what I lengthily explained
9th Sep 2017, 1:41 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
(-10+8)%10=-2%10 This one right
9th Sep 2017, 1:41 PM
Ravi Kumar
Ravi Kumar - avatar
+ 1
Thanks now understand it
9th Sep 2017, 1:43 PM
Ravi Kumar
Ravi Kumar - avatar