Modulo


#1

I don’t understand this math, can anyone please help me

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

My Task is this :
{
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’


#2

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

#3

Thank you so much for this help sir,

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


#4

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

Is it a quotient or what?


#5

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


#6

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.


#7

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