About
Quotient is the value we recevie upon divding one value by another whereas Remainder is the leftover value generated after performing the computation or division.
The below image will help you understand this a better way.
How to calculate
In the program we are asking user to input two variable “dividend” and “divisor”.
For example we will use 13 as dividend and 4 as divisor.
To calculate quotent we will use divide operator (“/”) and store the value in variable name “quotient”. e.g. 13/4 = 3
To calculate remainder we will use moduls operator (“%”) and store the value in remainder variable and display the outputs. e.g. 13%4 = 1
Method 1
#include <iostream>
using namespace std;
int main()
{
int divisor, dividend, quotient, remainder;
cout << "Enter dividend: "; //* input number *//
cin >> dividend;
cout << "Enter divisor: ";
cin >> divisor;
quotient = dividend / divisor; //* 13/4=3 *//
remainder = dividend % divisor; //* 13%4=1 *//
cout << "Quotient = " << quotient << endl; //* output print *//
cout << "Remainder = " << remainder; //* endl to end the line *//
return 0;
}
Output
Enter dividend: 13
Enter divisor: 4
Quotient = 3
Remainder = 1
We hope that this program helps you. If you have more better approach to solve the program which can be easily understand , feel free to drop a comment or write to us at admin@wikicoders.org . We will be more than happy to share the program.