can someone please explain me how the modulo works? I don’t really get how it works in Java…


Hi @pyramids ,

A modulo operation results in the remainder from dividing one number by another. The number that serves as the divisor is the modulus.

So, 17 % 4 yields a result of 1, because 4 divides into 17 by a full 4 times, with 1 left over.

1 Like

in addition to what @geomaticmashups has said take a look at this post to get an idea what the modulo operator does
Click here to post

I keep doing 5%3 to get a remainder of 2, but it doesn’t work what up with that?

it should work

     System.out.println(5%3); //will give 2

Thanks for the help bro :slight_smile:

Hi there buddy,
My name is ashtone and I am here to assist you.
The modulo is a greek word for mode. These are English only forums and we ask that you only ask for help in English.
Sorry for the trouble, but please read the rules and guidelines before asking for help.