#include <iostream>
int main()
{
int divisor, dividend, quotient, remainder;
std::cout << "Enter dividend: ";
std::cin >> dividend;
std::cout << "Enter divisor: ";
std::cin >> divisor;
quotient = dividend / divisor;
remainder = dividend % divisor;
std::cout << "Quotient = " << quotient << std::endl;
std::cout << "Remainder = " << remainder;
return 0;
}
To compute quotient and remainder, both divisor and dividend should be integers.
The division operator / is computes the quotient (either between float or integer variables).
The modulus operator % computes the remainder when one integer is divided by another (modulus operator cannot be used for floating-type variables).