In what situation would we want to use modulus (%) | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

In what situation would we want to use modulus (%)

19th Oct 2016, 2:00 PM
Alfredo Gonzalez
Alfredo Gonzalez - avatar
7 Réponses
+ 9
1.If we want to know the remainder of the quotient. 2. If we want to check whether the number is even or odd.
19th Oct 2016, 6:21 PM
Remmae
Remmae - avatar
+ 2
we use the when we have a need to find the remainder
22nd Oct 2016, 9:35 AM
Uzair Ahmed
Uzair Ahmed - avatar
+ 2
When you.do for examle number%10 it will give you the most right char. (Right side) It is usefull for bools, if, while. You will see in future
27th Nov 2016, 9:12 PM
Tomashuyk Maxim
Tomashuyk Maxim - avatar
+ 1
To find even/odd numbers, right most digits of a collection of nums , left most digits of a collection nums. And many more cases!
19th Oct 2016, 5:11 PM
Ousmane Diaw
+ 1
As a working programmer I need it every day, for example if you use flat array of n×m elements instead of two dimensional or in many other fields
28th Oct 2016, 4:14 AM
Oleg Tretiakov
Oleg Tretiakov - avatar
+ 1
It's very important for sorting out Tables. Look up table and hashing.
4th Nov 2016, 3:57 PM
Michael Emeribe
Michael Emeribe - avatar
+ 1
Useful whenever you need to know the reminder of an integer division. eg to find out if a number is a multiple of another one. or add up the digits of a large number.
22nd Dec 2016, 10:26 AM
ifl
ifl - avatar