What is a modulus operator like how can i can find the result of a modulus operation without the program what operation is it? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

What is a modulus operator like how can i can find the result of a modulus operation without the program what operation is it?

28th Dec 2016, 8:07 AM
Edoardo
Edoardo - avatar
3 Réponses
28th Dec 2016, 8:13 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 1
Thanks man
28th Dec 2016, 8:16 AM
Edoardo
Edoardo - avatar
+ 1
Modulus is the remainder of two integers being divided. For example, 5 / 2 = 2 (since integers are floored). However 5 % 2 = 1, since 2 can go into 5 twice evenly leaving a remainder of 1. Some more scratch work: 5 - 2 = 3 3 - 2 = 1 1 is the remainder. This can also be found doing long division. Another simple example, 4 % 2 = 0 since it can be evenly divided. Also one more is that 1 % 3 = 1 since 3 cannot divide into 1.
28th Dec 2016, 8:19 AM
Greg Ortiz
Greg Ortiz - avatar