3%10-1 = 2 how??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

3%10-1 = 2 how???

modulo operator is used for remainder.

9th May 2018, 5:31 PM
Syeda Zobia Kanwal
Syeda Zobia Kanwal - avatar
3 Answers
+ 1
simple rule remember this.. if L.H.S is smaller than R.H.S side in case of modulo The L.H.S is a answere 4%5=4 So simple 5| 4|0 . 4 i.e as we know modulo give us reminder.. I hope you understand.. i try as simple as i can..
9th May 2018, 6:53 PM
Arun Tomar
Arun Tomar - avatar
+ 6
step 1>> 3%10=3 //modulo operator has highest precedence step 2>> 3-1=2 that's the ways
9th May 2018, 5:33 PM
Scooby
Scooby - avatar
+ 1
thanks a lot! I didn't know about the l.h.s rule for the Smaller value, I was doing it by the other way.
9th May 2018, 7:36 PM
Syeda Zobia Kanwal
Syeda Zobia Kanwal - avatar