I don't get the idea of modulo. I just can't understand what should I do or what is the mathematical calculation behind it. THX

`Replace this line with your code.`

I don't get the idea of modulo. I just can't understand what should I do or what is the mathematical calculation behind it. THX

`Replace this line with your code.`

When you divide a number.

say if `X`

is divided by `Y`

,

You get two things.

`X / Y`

-- > Quotient say `Q`

and

`X % Y`

--> Remainder say `R`

`modulo`

is used to find this `R`

,It means It gives you remainder not quotient.

Example..

13 / 5 -- > gives you Quotient 2.

but

13 % 5 --> gives you Remainder 3.

for more..

http://www.dreamincode.net/forums/topic/273783-the-use-of-the-modulo-operator/

the examples provided makes sense to me however in my exercise in Modulo it asked to get to 2. the used this as my example 16 % 7. Wouldn't that come to 2? 7 can go into 16 two times and there would be 2 left over, right?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.