Good work! Let’s explore one more special math operator known as modulo.

  1. The modulo operator - represented in Java by the % symbol - returns the remainder of dividing two numbers.

For example, 15 % 6 will return the value of 3, because that is the remainder left over after dividing 15 by 6.



Use the modulo operator to set the variable myRemainder equal to 2. You can use any two numbers that return a remainder value of 2.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?