9. modulo operator

modulo operator remainder ? whats this ill its want a remainder 2 so i types 10/5 this will give 2 but this exp is wrong !!!

Modulo is different from division. Modulo gives just the remainder.

10 / 5 gives 2
10 % 5 gives 0

how is there any formula for obtaining remainder ???

I’m not really sure what you mean by that.

You can read the technical details of modulo here.

1 Like

i used 18 % 8; dont forget the ; or it wont go

2 Likes

7 % 5 gives 2
10 % 5 gives 0

A post was split to a new topic: 9. Why is 10/5 correct when it is division and not percentage (%)

Thank you!!! That helped a lot. I just needed to add the ;