# C++ Program to Find Quotient and Remainder

C++ProgrammingServer Side Programming

#### C in Depth: The Complete C Programming Guide for Beginners

45 Lectures 4.5 hours

#### Practical C++: Learn C++ Basics Step by Step

Most Popular

50 Lectures 4.5 hours

#### Master C and Embedded C Programming- Learn as you go

66 Lectures 5.5 hours

Quotient and Remainder are parts of division along with dividend and divisor.

The number which we divide is known as the dividend. The number which divides the dividend is known as the divisor. The result obtained after the division is known as the quotient and the number left over is the remainder.

dividend = divisor * quotient + remainder

For Example: If 15 is divided by 7, then 2 is the quotient and 1 is the remainder. Here, 15 is the dividend and 7 is the divisor.

15 = 7 * 2 + 1

A program to find quotient and remainder is as follows:

## Example

Live Demo

#include <iostream>
using namespace std;
int main() {
int divisor, dividend, quotient, remainder;
dividend = 15;
divisor = 7;
quotient = dividend / divisor;
remainder = dividend % divisor;
cout << "Dividend is " << dividend <<endl;
cout << "Divisor is " << divisor <<endl;
cout << "Quotient is " << quotient << endl;
cout << "Remainder is " << remainder;
return 0;
}

## Output

Dividend is 15
Divisor is 7
Quotient is 2
Remainder is 1

In the above program, the quotient is obtained by dividing the dividend by the divisor. The remainder is obtained by using the modulus operator on dividend and divisor.

quotient = dividend / divisor;
remainder = dividend % divisor;

After that the dividend, divisor, quotient and remainder are displayed.

cout << "Dividend is " << dividend <<endl;
cout << "Divisor is " << divisor <<endl;
cout << "Quotient is " << quotient << endl;
cout << "Remainder is " << remainder;
Updated on 23-Jun-2020 16:30:27