Hit enter after type your search item

3 C++ Programs to get Quotient and Remainder

How to get Quotient and Remainder using C++

In this part of the short tutorial series, we are going to show you how to get the quotient and remainder in C++.

As you execute the program, it asks you to enter the dividend and divisor values (3rd program). Then we will divide the two numbers and get the remainder and quotient and display both values.

See the C++ programs below.

C++ program to get remainder

In this C++ program, we will get the remainder after dividing two numbers. For that, we used the modulus operator (% sign).


The Remainder of 54/10 = 4

Get the quotient example

In order to get the remainder after the division of two numbers, use the forward slash / (division). The example below calculates and displays the remainder:



A simple program that takes user input and gets both – remainder and quotient

In this program, the user is asked to enter two numbers for division. Then we used slash (/) and modulus (%) to get the remainder and quotient. All values are displayed i.e.

  • Dividend
  • Divisor
  • Remainder
  • Quotient

Sample output:


Sample output as dividend is negative:


Sample output as the divisor is negative


This div height required for enabling the sticky sidebar