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 find quotient and remainder.

Quotient = dividend / divisor

Remainder = dividend % divisor

Example (find quotient and remainder):

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

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

/* C++ Program to find Quotient and remainder */
#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

Related Posts:

  1. Program to find largest amongst three numbers.
  2. Program to find factorial of a number.
  3. Program to find GCD of two numbers.
  4. Program to find LCM of two numbers.
  5. Program to check whether entered number is odd or even.
  6. Program to check whether entered number is prime number or not.
  7. Program to check whether entered number is palindrome or not.
  8. Program to check whether entered number is Armstrong Number or Not.
  9. Program to convert binary number to octal number.
  10. Program to convert binary number to decimal number.
  11. Program to convert binary number to hexadecimal number.
  12. Program to convert octal number to binary number.
  13. Program to convert octal number to decimal number.
  14. Program to convert octal number to hexadecimal number.
  15. Program to convert decimal number to binary number.
  16. Program to convert decimal number to octal number.
  17. Program to convert decimal number to hexadecimal number.
  18. Program to convert hexadecimal number to binary number.
  19. Program to convert hexadecimal number to octal number.
  20. Program to convert hexadecimal number to decimal number.

You may also like...