Q:

C++ Program to Find Quotient and Remainder of 2 numbers

belongs to collection: C++ Basic Solved Programs

0

Write a C++ Program to Find Quotient and Remainder of 2 numbers. Here’s simple C++ Program to Find Quotient and Remainder of 2 numbers in C++ Programming Language.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

  • In this program, 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.

Here is source code of the C++ Program to Find Quotient and Remainder of 2 numbers. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.

 
 

SOURCE CODE : :

/*  C++ Program to Find Quotient and Remainder of 2 numbers  */

#include <iostream>
using namespace std;

int main()
{
    int divisor, dividend, quotient, remainder;

    cout << "Enter dividend :: ";
    cin >> dividend;

    cout << "\nEnter divisor :: ";
    cin >> divisor;

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

    cout << "\nQuotient = " << quotient << endl;
    cout << "\nRemainder = " << remainder<<endl;

    return 0;
}

Output : : 


/*  C++ Program to Find Quotient Remainder of 2 numbers  */

Enter dividend :: 1234

Enter divisor :: 5

Quotient = 246

Remainder = 4

Process returned 0

Above is the source code for C++ Program to Find Quotient Remainder of 2 numbers which is successfully compiled and run on Windows System.The Output of the program is shown above .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Basic Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C++ Program to Swap Two Numbers without using thir... >>
<< Write a C++ Program to Add Two Numbers...