Modulus Operator ProblemDate: 2/12/96 at 16:44:7 From: Ruby Mayes Subject: modulus operator Can you explain this problem to me 4 % 3 = I believe this is the modulus operator but can you give me some information and the rule about working such a problem? Date: 2/13/96 at 18:42:13 From: Doctor Ethan Subject: Re: modulus operator Hi there, Ruby. I think you're right that '%' is being used as the modulus operator. It is probably most often seen in the form: 4 mod 3 but computer programmers use the % shorthand in several languages, and it is also fairly fast way of typing it. The modulus operator returns the remainder when the first number is divided by the second. Here are some examples: 1 mod 3 = 1 (or 1 % 3 = 1) 2 mod 3 = 2 3 mod 3 = 0 4 mod 3 = 1 5 mod 3 = 2 6 mod 3 = 0 etc... This seemingly simple operator is actually a very powerful tool for mathematicians, especially those who specialize in Number Theory. I hope this answered your questions. -Doctor Ethan, The Math Forum |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/