# Modulo

{
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.
}

and when I type 20 % 10, then its showing me value ‘0’

One way to always get 2 as a remainder is to have a difference of two between dividend and divisor…

``````5 % 3  =>  2
7 % 5  =>  2``````

Thank you so much for this help sir,

But could you plz explain me this concept. I still don’t understand the point.

What exactly “%” this symbol stands for in Java?

Is it a quotient or what?

Oh… I got it. Sorry for this silly question. since we don’t use remainder anymore in our day to day life during calculation of quotient. I read about it and I understood the exact meaning of Remainder during Divide

The root implication for modulo is “modulation”. Modulation is what a periodic wave does. Think AM and FM. Amplitude modulation and frequency modulation. One is a wave that looks like a bunch of eyes, the other a wave of uniform amplitude that looks compressed and expanded, alternately.

Days of the week, months of the year, cards of a suit, all modulate around a base period, 7, 12, and 13, respectively. Modulation appears in a great many situations. so `modulo` is a no-brainer to spot it. Look for repetition in patterns when detecting it. Some x modulo y creates a pattern of repetition.

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