C++ Program to Find Quotient and Remainder

In this basic C++ program, we will have a look at how to find quotient & remainder in C++. In this program, the user is asked to enter two integers (divisor and dividend) and computes the quotient and remainder.

To compute quotient and remainder, both divisor and dividend should be integers.

C++ Program to Find Quotient and Remainder

#include <iostream>
using namespace std;
int main()
    int divisor, dividend, quotient, remainder;
    cout << "Please enter dividend: ";
    cin >> dividend;
    cout << "Please enter divisor: ";
    cin >> divisor;
    quotient = dividend / divisor;
    remainder = dividend % divisor;
    cout << "Quotient = " << quotient << endl;
    cout << "Remainder = " << remainder;
    return 0;


Please enter dividend: 17
Please enter divisor: 5
Quotient = 3
Remainder = 2

Leave a Comment

Your email address will not be published. Required fields are marked *