Mod

R

RN1

79 Mod 92 evaluates to 79

156 Mod 249 evaluates to 156

So while using the Mod operator, if the first number is less than the
second number, will the result be ALWAYS EQUAL to the first number?
 
B

Bob Barrows [MVP]

RN1 said:
79 Mod 92 evaluates to 79

156 Mod 249 evaluates to 156

So while using the Mod operator, if the first number is less than the
second number, will the result be ALWAYS EQUAL to the first number?

Yes. Think back to second or third grade when learning about division.
If you divide 79 by 92, you got a remainder, right? 92 gazinto 79 zero
times with a remainder of 79.
That's the modulus, or mod for short.
 
A

Anthony Jones

B

Bob Barrows [MVP]

RN1 said:
-19 Mod 7 evaluates to -5....that's fine but

-19 Mod -7 also evaluates to -5. Why? Shouldn't it evaluate to 5?

-7 * 2 = -14

What do you have to add to -14 to get -19?
Also how does 19 Mod -7 evaluate to 5 (& not -5)?

Again, -7 * -2 = 14. What do you have to add to 14 to get 19?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top