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

By | 23.12.2016

Find Quotient and Remainder


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.


  • 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 .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

4 12 votes
Article Rating
Category: Basic Programs C++ Programming

About Tunde A

My name is Tunde Ajetomobi, a Tech Enthusiast and Growth Hacker. I enjoy creating helpful content that solves problem across different topics. Codezclub is my way of helping young aspiring programmers and students to hone their skills and find solutions on fundamental programming languages.

Subscribe
Notify of
guest

6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Alexis Siobhan Douglas

Do you have a suggestion for how to account for decimal answers? float remainder or double quotient? Should I use showpoint? Also, what about showing an error message for when a user uses 0 as a divisor?

gamal

by creating a variabel call double instead of int

random

please change your ui to white its really irretating

VIP111

what is UI??

kutty

design

Hobist

Very useful 🙂 Thank you )))