+ 4

[Solved] About remainder and modulo

What is % operator? And ............

21st Dec 2020, 10:12 AM
Mohammad Sefatullah
Mohammad Sefatullah - avatar
6 Answers
+ 2
Please use the search bar
21st Dec 2020, 10:34 AM
Sonic
Sonic - avatar
+ 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 ...
21st Dec 2020, 10:45 AM
Lothar
Lothar - avatar
+ 2
😂😂 oo sorry, I was writing 24 as in the example of maths, I wrote 20, my typing mistake..... Thanks for noticing it😉
21st Dec 2020, 10:55 AM
Bibek Oli
Bibek Oli - avatar
+ 1
Modulo operator
21st Dec 2020, 10:34 AM
Sonic
Sonic - avatar
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
21st Dec 2020, 10:23 AM
Bibek Oli
Bibek Oli - avatar