Don’t stop learning now. Get hold of all the important Java fundamentals with the Simple java program example guide and practice well.

Given two numbers , the task is to print their quotient and Remainder inĀ Python.

**Examples:**

**i)Floating Division**

**Example1:**

**Input:**

first number =45 second number =17

**Output:**

The value of quotient after dividing 45 / 17 = 2.6470588235294117 The value of remainder after dividing 45 / 17 = 11

**ii)Integer Division**

**Input:**

first number =45 second number =17

**Output:**

The value of quotient after dividing 45 / 17 = 2 The value of remainder after dividing 45 / 17 = 11

## Program to Read Two Numbers and Print Their Quotient and Remainder inĀ Python

Below are the ways to print the quotient and Remainder:

- Using / and % modulus operator in Python (User Input separated by new line, Float Division)
- Using / and % modulus operator in Python (User Input separated by spaces , Float Division)
- Using // and % modulus operator in Python (User Input separated by spaces , Integer Division

### 1)Using / and % modulus operator in Python (User Input separated by new line, Float Division)

**Approach:**

- Scan the given two numbers using int(input()) and store them in two separate variables.
- Calculate the quotient by using the syntax first number /second number and store it in a variable.
- Calculate the remainder by using the syntax first number %second number and store it in a variable.
- Print the above two variables which are the result of the program
- Exit of Program.

**Below is the implementation:**

# scanning the given two numbers using int(input()) function # first number numb1 = int(input("Enter some random number = ")) # second number numb2 = int(input("Enter some random number = ")) # Calculate the quotient by using the syntax first number /second number # and store it in a variable. quotie = numb1/numb2 # Calculate the remainder by using the syntax first number %second number # and store it in a variable. remain = numb1 % numb2 # Print the above two variables which are the result of the program print("The value of quotient after dividing", numb1, "/", numb2, " = ", quotie) print("The value of remainder after dividing", numb1, "/", numb2, " = ", remain)

**Output:**

Enter some random number = 86 Enter some random number = 12 The value of quotient after dividing 86 / 12 = 7.166666666666667 The value of remainder after dividing 86 / 12 = 2

### 2)Using / and % modulus operator in Python (User Input separated by spaces , Float Division)

**Approach:**

- Scan the given two numbers using map and split() functions to store them in two separate variables.
- Calculate the quotient by using the syntax first number /second number and store it in a variable.
- Calculate the remainder by using the syntax first number %second number and store it in a variable.
- Print the above two variables which are the result of the program
- Exit of Program.

**Below is the implementation:**

# Scan the given two numbers using map and split() functions # to store them in two separate variables. numb1, numb2 = map(int, input("Enter two random numbers separated by spaces = ").split()) # Calculate the quotient by using the syntax first number /second number # and store it in a variable. quotie = numb1/numb2 # Calculate the remainder by using the syntax first number %second number # and store it in a variable. remain = numb1 % numb2 # Print the above two variables which are the result of the program print("The value of quotient after dividing", numb1, "/", numb2, " = ", quotie) print("The value of remainder after dividing", numb1, "/", numb2, " = ", remain)

**Output:**

Enter two random numbers separated by spaces = 45 17 The value of quotient after dividing 45 / 17 = 2.6470588235294117 The value of remainder after dividing 45 / 17 = 11

### 3)Using // and % modulus operator in Python (User Input separated by spaces , Integer Division)

**Approach:**

- Scan the given two numbers using map and split() functions to store them in two separate variables.
- Calculate the integer quotient by using the syntax
**first number //second numbe**r and store it in a variable. - Calculate the remainder by using the syntax first number %second number and store it in a variable.
- Print the above two variables which are the result of the program
- Exit of Program.

**Below is the implementation:**

# Scan the given two numbers using map and split() functions # to store them in two separate variables. numb1, numb2 = map(int, input("Enter two random numbers separated by spaces = ").split()) # Calculate the quotient by using the syntax first number /second number # and store it in a variable. quotie = numb1//numb2 # Calculate the remainder by using the syntax first number %second number # and store it in a variable. remain = numb1 % numb2 # Print the above two variables which are the result of the program print("The value of quotient after dividing", numb1, "/", numb2, " = ", quotie) print("The value of remainder after dividing", numb1, "/", numb2, " = ", remain)

**Output:**

Enter two random numbers separated by spaces = 45 17 The value of quotient after dividing 45 / 17 = 2 The value of remainder after dividing 45 / 17 = 11

**Related Programs**:

- Program to Read a Number n and Compute n+nn+nnn in C++ and Python
- Python Program to Read a File and Capitalize the First Letter of Every Word in the File
- Python Program to Read a Text File and Print all the Numbers Present in the Text File
- Python Program to Read Print Prime Numbers in a Range using Sieve of Eratosthenes