+ 1

i need help understanding the modulus operator (%)

'm trying to learn C# and not knowing how this operator works is making it really hard for me to learn C#. I tried to go back to basic concepts to figure it out and looked at the commits explaining how it works but I just can't seem to understand it and that really bothers me. Can anyone PLZ help me understand how the modulus operator works, I'm kinda a slow learner.

13th Jun 2017, 10:25 PM
Mohammed Syed
Mohammed Syed - avatar
3 Réponses
+ 3
The modulus operator gives the value of remainder when you divide two numbers.. For example 7%5 gives 2..similarly 4%2 gives zero as the remainder is zero
13th Jun 2017, 10:34 PM
Rajat Karnwal
Rajat Karnwal - avatar
13th Jun 2017, 11:28 PM
Raz
Raz - avatar
+ 2
modulus operator in any program simply means the division of two numbers with a remainder.
16th Jun 2017, 6:52 PM
Adams Daniel
Adams Daniel - avatar