Find Quotient and Remainder in C++ language
ADVERTISEMENTS
Find quotient and remainder in c++ language. In this article, you will learn how to find quotient and remainder in c++ language.
Source Code
// Find Quotient and Remainder in C++ language
#include <iostream>
using namespace std;
int main() {
int dn, dr, qu, rem;
// dn - denotes the dividend
// dr - denotes the divisor
// qu -denotes the Quotient
// rem - denotes the remainder
cout << "-----Enter the dividend & divisor to compute the quotient and remainder-----\n";
cin >> dn >> dr;
// Computes the quotient
qu = dn / dr;
// Computes the remainder
rem = dn % dr;
cout << "\nThe Quotient is " << qu << "\n";
cout << "The Remainder is " << rem << "\n";
return 0;
}
Output
-----Enter the dividend & divisor to compute the quotient and remainder-----
34
23
The Quotient is 1
The Remainder is 11