+ 1

MĂłdulo question

Can someone explain modulo? For instance in this problem why is the remainder 6.333? X = 6.333 X %= 9

5th May 2022, 2:35 AM
Sal
1 Answer
+ 1
Sal remainder is 6.333 because modulo operatore return the remainder, upto the point when the numerator is perfectly divisible by deniminator for example say, num1 = 10, num2 = 5 when, num1 / num2 = 2 but num1 % num2 = 0 in your case, X = X % 9, X = 6.333 % 9, since denominator is 9 and numerator is 6.333. 9 is greater than 6.333 so if 6.333 / 9 = 0.7036 (say) but 6.333 % 9 = 6.333, because we are doing modulo operation not division and 6.333 is not perfectly divisible by 9 more example, say, 1 / 2 = 0.5 but 1 % 2 = 1, because 1 is not perfectly divisible by 2 5 % 2 = 1,
5th May 2022, 2:48 AM
NonStop CODING
NonStop CODING - avatar