# Modulo Operation

## Modulo Operation

In computing, the **modulo operation**, sometimes also called "remainder" or "rest", gives the remainder from a division. It finds the remainder of division of one number by another.

In general, when talking about arithmetic operations, we recognize the following operations:

Operation | Syntax | Result |

Addition | a + b | the sum of a and b |

Subtraction | a - b | b subtracted from a |

Negation | - a | minus a |

Multiplication | a * b | a multiplied by b |

Division | a / b | a divided by b |

Modulo | a % b | the remainder of a division between a and b |

Given two numbers, a (the dividend) and n (the divisor), a modulo n (abbreviated as a mod n) is the remainder, on division of a by n.

For example, if you divide 7 by 3, 3 goes in 7 two times. But there is a remainder of **1**, and that is the result of the modulo operation.

The expression "9 mod 3" would evaluate to 0.

Although typically performed with a and n both being integers, many computing systems allow other types of numeric operands. There are various ways of defining a remainder, and computers and calculators have various ways of storing and representing numbers, so what exactly constitutes the result of a modulo operation depends on the programming language and/or the underlying hardware.

With**floating-point**division, such as in 9.0 / 4.0, the result is a floating-point value, in this case 2.25. But with

**integer**division, such as in 9 / 4, the result is only the integer part, in this case 2.

#### Modulo in calculators

Some calculators have a mod() function button, and many programming languages have a mod() function or similar, expressed for example as mod(a,n).

Some calculators display expressions on the keyboard that say "%", "mod", or "Mod" as a modulo or remainder operator, such as a % n or a mod n.

**discussion forum**. Visit our discussion forum to see more. It is possible the links below are not related to this page, but you can be certain you will find related posts in the discussion forum. You can post one yourself too.)

It is easy, just include the code provided below into your HTML code.