# C++ Program to Find Quotient and Remainder

In this post, we will learn how to compute quotient and remainder using C++ Programming language.

The quotient is the number obtained by dividing one by another. For example, if we divide 17 by 4, the result obtained is 4, which is the quotient.

Remainder is the leftover part of the number left after certain steps and cannot be divided further. For example, if we divide 15 by 2, we get 1 as the remainder which cannot be divided further.

This program takes dividend and divisor as the input and computes quotient and remainder using arithmetic operators.

So, without further ado, let’s begin this tutorial.

## C++ Program to Find Quotient and Remainder

```// C++ Program to Find Quotient and Remainder
#include <iostream>
using namespace std;

int main(){
int dividend, divisor, rem, quot;

cout << "Enter the dividend: ";
cin >> dividend;
cout << "Enter the divisor: ";
cin >> divisor;

// Computing quotient
quot = dividend / divisor;

// Computing remainder
rem = dividend % divisor;

// Displaying output
cout << "Quotient is: " << quot << endl;
cout << "Remainder is: " << rem << endl;
return 0;
}
```

Output

``````Enter the dividend: 27
Enter the divisor: 11
Quotient is: 2
Remainder is: 5
``````

## How Does This Program Work ?

```    int dividend, divisor, rem, quot;
```

In this program, we have declared four integer data type variables named dividend, divisor, rem and quot.

```    // Asking for input
cout << "Enter the dividend: ";
cin >> dividend;
cout << "Enter the divisor: ";
cin >> divisor;
```

Now, the user is asked to enter the dividend and the divisor.

```    // Computing quotient
quot = dividend / divisor;
```

Quotient is calculated using (/) division operator. Division (/) operator returns quotient after the division.

```    // Computing remainder
rem = dividend % divisor;
```

Similarly, remainder is calculated with the help of (%) Modulus operator. Modulus (%) operator returns remainder after division.

```    // Displaying output
cout << "Quotient is: " << quot << endl;
cout << "Remainder is: " << rem << endl;
```

The quotient and the remainder is displayed on the screen using the cout statement.

## Conclusion

I hope after going through this post, you understand how to find  the quotient and remainder using C++ Programming language.

If you have any doubt regarding the program, then contact us in the comment section. We will be delighted to solve your query.