In this programming tutorial, we will write a program to find the quotient and remainder of two numbers. When we divide two numbers the result we get is the quotient, it is the number of times a division is divided completely. A remainder is a value that is left after division when the divisor could not divide the dividend completely.

##
**
Algorithm
**

- To find the quotient in programming languages we use / operator
- And to find remainder we use % (modulo) operator.

###
**
C Program to find quotient and remainder of two numbers
**

```
#include <stido.h>
int main()
{
int dividend, divisor, quotient, remainder;
//ask user to enter dividend and divisor
printf("Enter dividend and divisor (eg 20 5): ");
scanf("%d %d", ÷nd, &divisor);
quotient = dividend/divisor;
remainder = dividend%divisor;
printf("The quotient is: %d \n", quotient);
printf("The remainder is: %d", remainder);
return 0;
}
```

**
Output
**

```
Enter dividend and divisor (eg 20 5): 50 4
The quotient is: 12
The remainder is: 2
```

###
**
C++ Program to find quotient and remainder of two numbers
**

```
#include <iostream>
using namespace std;
int main()
{
int dividend, divisor, quotient, remainder;
//ask user to enter dividend and divisor
cout<<"Enter dividend and divisor (eg 20 5): "; cin>>dividend>> divisor;
quotient = dividend/divisor;
remainder = dividend%divisor;
cout<<"The quotient is: "<< quotient<<endl;
cout<<"The remainder is: "<< remainder;
return 0;
}
```

**
Output
**

```
Enter dividend and divisor (eg 20 5): 60 30
The quotient is: 2
The remainder is: 0
```

###
**
Python Program to find quotient and remainder of two numbers
**

```
dividend, divisor = map(int, input("Enter dividend and divisor (eg 20 5): ").split())
quotient = dividend//divisor
remainder = dividend%divisor
print("The Quotient is: ", quotient)
print("The remainder is: ", remainder)
```

**
Output
**

```
Enter dividend and divisor (eg 20 5): 50 6
The Quotient is: 8
The remainder is: 2
```

##
**
Conclusion
**

In this programming tutorial, we learned how to find the quotient and remainder of two numbers in C, C++, and Python. To find the quotient of two numbers we simply divide them and to find the reminder we have a modulo operator in every programming language .

**
People are also reading:
**

- WAP in C++ and Python to calculate 3X3 Matrix multiplication
- WAP to swap two numbers
- WAP in C++ and python to check whether the number is even or odd
- WAP in C++ and python to convert temperature from Fahrenheit to Celsius and vice-versa
- WAP to check whether a given character is an alphabet, digit or any special character
- WAP in C++ and python to check whether the year is a leap year or not
- Binary Search in C
- Write a C++ Calculator to perform Arithmetic Operations using Switch Case
- Perfect Number in C
- WAP in C to check whether the number is a Palindrome number or not

## Leave a Comment on this Post