0
Does using modulo % matter which way the numbers are??
example 3 % 10 = 3 reminder 1 10 % 3 = ?
3 Antworten
+ 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
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
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