Hello, so while calculating, I was wondering, what’s difference between / and %? Please do it pretty simple for I can understand
/ is division, % is the remainder of the division
14 / 4 = 3.5
14 % 4 = 2 because 14 = 4 * 3 + 2 (remainder)
Wait, so why x 3? I don’t get it
It looks like if it was a math.floor() lol!
Because that’s the mathematical definition of the remainder
R = X % Y if and only if
X = Y * k + R, where
R is a smallest possible non negative integer and
k is an integer.