Can anyone clear the concept of modulus | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can anyone clear the concept of modulus

modules

16th Mar 2018, 8:50 PM
Saira Mirza
Saira Mirza - avatar
3 Answers
16th Mar 2018, 9:16 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 1
Basically it calculates what's left (the remainder) from a division. For instance, dividing between odd and even numbers will often leave a remainder greater than 0. An example: 8/3 = 2, remainder = 2 --> 3 goes into 8 twice & leaves out 2 (sorry if this confuses you more). More examples: 5/4 = 1, remainder = 1 2/2 = 1, remainder = 0 19/5 = 3, remainder = 4 How I used to calculate it as a kid, using the last example, I'd count the multiples of 5, so 5 10 15, then stop there and see how much I need to get from 15 to 19, 4 in this case. Easy way to calculate with a calculator: divide as you normally do, then remove the numbers after the decimal point, multiply by the number you divided with, here your remainder will be the number you get when you subtract the answer you got from the original number you divided.
16th Mar 2018, 11:38 PM
Jiren The Grey
Jiren The Grey - avatar
0
Modulus is represented using the symbol%, If we take 5%(modulus)3= the quotient is 1 and remainder is 2 ,Here we take remainder as answer.
3rd Sep 2019, 12:09 AM
Kavya EL
Kavya EL - avatar