what is modulo | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is modulo

tell me in detail

26th Oct 2016, 6:13 PM
Tejas Gaikwad
Tejas Gaikwad - avatar
8 Answers
+ 5
modulo = the remainder of a division. 3%2 = 1 (3 = 2*1 + 1) 15%8 = 7 (15 = 8*1 + 7) most languages use the symbol % to present it.
29th Oct 2016, 8:40 PM
Hamidreza Fathi
Hamidreza Fathi - avatar
+ 4
In simple words, a%b gives the remainder when a is divided by b Most students are taught that "Dividend = Divisor * Quotient + Remainder" In more sophisticated language, this is the Division Algorithm : For any integers a and b such that b is non-zero, there exist unique integers q and r such that a = b*q + r where 0<=r<b So a%b gives r For example, 9 = 2*4 + 1 So 9%2 = 1 Another way to think about it is something like this. Imagine you have 26 apples and you want to pack them in groups of 7. 26%7 will give you the number of apples left after all the groupings are done. In this case, you will get 3 groups of 7 apples accounting for 21 apples with 5 apples left. These 5 apples cannot be packed into groups of 7 as 5<7 So 26 = 7*3 + 5 This means 26%7 = 5 Note that making 0 groups is allowed, but the number of remaining apples should be less than that in each group.
19th Jan 2017, 12:27 PM
Dhaval Furia
Dhaval Furia - avatar
+ 3
Before that you have to know that Operaters Assignment s Concepts in Any Programming Language i believe you know that Modulo is also one of the operator for calculations it is represented by "%" The purpose of using this operator is to find Remainder Lets take an example if 24℅12 Quotient is 2 Remainder is 0 or 13%2 in this case Quotient is 6 Remainder is 1 This is how it is useful
26th Oct 2016, 8:15 PM
Ugra Narasimha
Ugra Narasimha - avatar
+ 1
modulo is % when modulo is performed over numbers it gives remainder as output. 1%2 : 1 4%2 : 0 5%3 : 2
5th Nov 2016, 3:54 AM
Dinesh Devaki
Dinesh Devaki - avatar
+ 1
modulo operator is used for finding the reminder..for example 9%2 =1
5th Nov 2016, 7:00 AM
smita naik
smita naik - avatar
+ 1
it means remainder
1st Dec 2016, 1:03 AM
JONH GITAU MKANGAI
JONH GITAU MKANGAI - avatar
+ 1
to get the remainder
5th Mar 2017, 2:31 PM
Abhimanyu Singh
Abhimanyu Singh - avatar
0
The modulo operator is %. It is the remainder after dividing. For example: 9%4 = 1 or 13%5=3
26th Oct 2016, 6:19 PM
Bullsoog