C++ Program to Find Quotient and Remainder
Find Quotient and Remainder in C++
What is Quotient(/): According to mathematical definition “a result obtained by dividing one quantity by another.”What is Remainder (%):a part, number, or quantity that is left over
In this example, you will learn to find the quotient and remainder of a given dividend and divisor.In this program, user enter two integers (divisor and dividend) and computes the quotient and remainder.
To compute quotient and remainder, both divisor and dividend should be integers.
Example: Program of quotient and remainder
#include<iostream>
#include<conio>
int main()
{ int divisor, dividend, quotient, remainder;
cout << "Enter dividend: ";
cin >> dividend;
cout << "Enter divisor: ";
cin >> divisor;
quotient = dividend / divisor;
remainder = dividend % divisor;
cout << "Quotient = " << quotient << endl;
cout << "Remainder = " << remainder;
getch ();
return 0;
}
#include<conio>
int main()
{ int divisor, dividend, quotient, remainder;
cout << "Enter dividend: ";
cin >> dividend;
cout << "Enter divisor: ";
cin >> divisor;
quotient = dividend / divisor;
remainder = dividend % divisor;
cout << "Quotient = " << quotient << endl;
cout << "Remainder = " << remainder;
getch ();
return 0;
}
Quotient and Remainder program |
C++ Program to Find Quotient and Remainder
ReplyDelete
ReplyDeleteC++ Program to Find Quotient and Remainder