The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Modulus Operator Problem

Date: 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

This seemingly simple operator is actually a very powerful tool 
for mathematicians, especially those who specialize in Number 

I hope this answered your questions.

-Doctor Ethan,  The Math Forum

Associated Topics:
High School Number Theory

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.