C++ program to calculate the quotient and remainder of given two numbers

C++ program to calculate the quotient and remainder of given two numbers
You will learn about C++ program to calculate the two integers (divisor and dividend) and computes the quotient and remainder using a function and without function. To compute quotient and remainder, both divisor and dividend should be integer.

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).

For the better understanding of this program you have to know more about the following C++ programming topic(s) :

    C++ function

The formula is to calculate quotient and remainder  is:

    quotient    =   dividend / divisor
    remainder   =   dividend % divisor

Example#3.0: C++ program to calculate the quotient and remainder of two numbers without function:



Output

Enter dividend   : 36
Enter divisor    : 7
Quotient         : 5
Remainder        : 1
Press Enter to return to Quincy...

 

Example#3.1: C++ program to calculate the quotient and remainder of two numbers using function:



Output

Enter dividend   : 36
Enter divisor    : 7
Quotient         : 5
Remainder        : 1
Press Enter to return to Quincy...

Post a Comment

Previous Post Next Post