# Write a program to read two numbers and print their quotient and remainder in Python

In this post, we will write a simple **Python** program that takes input from the user and calculates the quotient and remainder operation.

There are different ways to achieve this task. Here, we are mentioning two ways to read two numbers and print their quotient and remainder in Python. The quotient is the result of the division, while the remainder is the value remaining after the division.

## Python find quotient and remainder using Naive Method

In this method, first we take two inputs from the user using the **input()** function and store them in two variables, and then we obtain the quotient using division and the remainder using the modulus operator.

```
# Get quotient and remainder
# using Python program
def find(n, m):
# for quotient
q = n//m
print("Quotient: ", q)
# for remainder
r = n%m
print("Remainder", r)
# User Input
a=int(input("Enter the first number: "))
b=int(input("Enter the second number: "))
find(a,b)
```

**Output of the above code-**

```
Enter the first number: 20
Enter the second number: 5
Quotient: 4
Remainder 0
Enter the first number: 89
Enter the second number: 3
Quotient: 29
Remainder 2
```

## Python find quotient and remainder using divmod() method

The **divmod()** function takes two numbers and returns a tuple containing the quotient and the remainder.

**Syntax of divmod()**

**divmod(divident, divisor)**

Here, the **divident** is the number you want to divide, and the **divisor** is the number you want to divide with.

```
# Get quotient and remainder
# using Python program
# Get user inputs
a=int(input("Enter the first number: "))
b=int(input("Enter the second number: "))
q, r = divmod(a,b)
print("Quotient: ", q)
print("Remainder: ", r)
```

**Output of the above code-**

```
Enter the first number: 43
Enter the second number: 2
Quotient: 21
Remainder: 1
Enter the first number: 34
Enter the second number: 6
Quotient: 5
Remainder: 4
```

### Related Articles

** Program to calculate simple interest in Python Python program to input week number and print week day Local variable referenced before assignment Python Multiply all elements in list Python Program to calculate simple interest in Python Program to find area of triangle in Python Python program to multiply two numbers Python projects for beginners Find average of n numbers in Python Reverse pyramid pattern in Python Stemming and Lemmatization in Python Python program to convert decimal to binary Print multiplication table in PythonFibonacci Series In Python | Python Program To Print File Handling in Python How to convert XML to JSON in Python Python XML to Dictionary Python program to multiply two matrices**