0

Does using modulo % matter which way the numbers are??

example 3 % 10 = 3 reminder 1 10 % 3 = ?

26th Jul 2017, 2:18 PM
D_Stark
D_Stark - avatar
3 Answers
+ 3
It certainly matters 3 % 10 = 3 10 % 3 = 1 even the sign of two operand is important to consider https://pasteboard.co/GCmp9GQ.jpg
26th Jul 2017, 2:27 PM
Babak
Babak - avatar
0
10%3 gives 3 + 3 + 3 + 1 reminder (thats why the result is 1) because 3 fits in 10 three times - with 1 reminder 3%10 gives 0 + 3 rest (thats why the result is 3) because 10 does not fit in 3 (zero times) - and we have 3 as reminder
26th Jul 2017, 2:32 PM
Martin Ed
Martin Ed - avatar
0
thanks guys i forgot about this and sololearn had a question 8 % 5 = "i put 3 just becuase i swapped them around" but i had a feeling that wasn't right becuase either way its 3
26th Jul 2017, 2:42 PM
D_Stark
D_Stark - avatar