Quotient and remainder

This is a simple program written in the C++ programming language that calculates the quotient and remainder of a division operation.

The first line #include <iostream> is a preprocessor directive that includes the iostream header file. The header file provides input and output functions, such as cout and cin.

The line using namespace std; is used to make the program more concise by including the standard namespace.

The main function is the starting point of the program, and it consists of several statements.

The first section declares four integer variables: dividend, divisor, quotient, and remainder.

The next section uses the cout statement to print the prompt “Please enter dividend: ” and the cin statement to read the value of the dividend from the user. The same process is repeated for the divisor.

The division operation is performed with the line quotient = dividend / divisor;. The division operator (/) returns the quotient of the division, and it is stored in the quotient variable.

The remainder is calculated with the line remainder = dividend % divisor;. The modulo operator (%) returns the remainder of the division and it is stored in the remainder variable.

The last section uses the cout statement to display the values of the quotient and remainder to the user.

Finally, the return 0; statement indicates that the program has executed successfully and returns a zero status to the operating system.

#include &lt;iostream&gt;
using namespace std;

int main () {
    int dividend, divisor, quotient, remainder;

    cout << "Please enter dividend: " << endl;
    cin >> dividend;
    cout << "Please enter divisor: " << endl;
    cin >> divisor;

    quotient = dividend / divisor;
    remainder = dividend % divisor;

    cout << "Quotient is: " << quotient << endl;
    cout << "Remainder is: " << remainder;
    return 0;
Please enter dividend: 75
Please enter divisor: 8
Quotient is: 9
Remainder is: 3