C++ Program to find quotient and remainder


In this program, You will learn how to find quotient and remainder in C++.


2 = 10 / 5

0 = 10 % 5


Example: How to find quotient and remainder in C++

Run it Now
#include<iostream>
using namespace std;

int main() {

    int a, b, c, d;
    cout << "Enter First Number :";
    cin>>a;
    cout << "\nEnter Second Number :";
    cin>>b;

    c = a / b;
    d = a % b;

    cout << "\nQuotient is :" << c;
    cout << "\nRemainder is :" << d;

    return 0;
}

Output:

Enter First Number :8
Enter Second Number :4
Quotient is :2
Remainder is :0