+ 4
[Solved] About remainder and modulo
What is % operator? And ............
6 Answers
+ 2
Please use the search bar
+ 2
March Zucherberg , there are some issues in your post:
(1) 20 % 5 = 4 -> this is not correct. the result as remainder will be 0. 4 is the quotient.
(2) rem = 20 % 5 # will also get 0, so print(rem) will give 0 and not 4.
I don't understand this post - you can easily check this in a python console or in a small script. but may be you are overloaded with your work in phracebook ...
+ 2
đđ
oo sorry, I was writing 24 as in the example of maths, I wrote 20, my typing mistake.....
Thanks for noticing itđ
+ 1
Modulo operator
0
% operator helps to find remainder when 2 numbers are divided.
Eg:
In maths:
5)24(4
-20
_____
Rem = 4
In Programming:
24 % 5 = 4
ÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻ
rem = 24 % 5
print(rem) //will print 4