**Getting a remainder**

Listing 5 illustrates the use of the
*modulus* operator to get and display the remainder produced by an integer
division.

**An integer quotient**

This code performs an integer division to get and display an integer quotient. In this case, the remainder or fractional part is discarded.

**The remainder**

Then the code in performs a modulus operation to get and display the remainder produced by the same integer division. In this case, the quotient is discarded.

The output produced by the code in Listing 5 is shown in Figure 3.

The modulus operator For 11/3: Quotient = 3 Remainder = 2 |