Find Quotient and Remainder

Find Quotient and Remainder” is very basic programming exercise for beginners. Here, we are given divisor and dividend and our task is to write a program to compute the quotient and remainder.

Quotient = dividend / divisor

Remainder = dividend % divisor

Example:

INPUT:
Dividend = 10, Divisor = 5
OUTPUT:
Quotient : 2
Remainder : 0

C++ Program to compute Quotient and remainder is as follows:

#include<bits/stdc++.h>  
using namespace std;  
int main()  
{  
    //Scan Dividend and Divisor  
    int dividend, divisor;  
    cout<<"Enter the dividend and divisor respectively:";  
    cin>>dividend>>divisor;  
      
    //compute Quotient  
    int Quotient = dividend / divisor;  
      
    //compute Remainder  
    int Remainder = dividend % divisor;  
      
    cout<<"Quotient : "<<Quotient<<"\n";  
    cout<<"Remainder: "<<Remainder<<"\n";  
}  

OUTPUT:
Enter the dividend and divisor respectively: 10 5
Quotient : 2
Remainder: 0

You may also like...

Leave a Reply

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