Codeforcoding

Python Program to compute Quotient and Remainder

Python Program to compute Quotient and Remainder of two number

In this tutorial, we will discuss the concept of Python Program to compute Quotient and Remainder of two numbers when the one number divided by another

In this topic, we are going to learn how to calculate quotient and remainder of two numbers in Python programming language

Python Program to compute Quotient and Remainder of two number
compute Quotient and Remainder of two number

What is quotient and remainder

To find the quotient, we have used the division(/) operator. we have divided (dividend by divisor) two numbers

To find remainder, we have use modular(%) operator . The dividend is divide by the divisor and the remainder is returned by the modular(%) operator

 

Python program to find quotient and remainder

Program to find quotient and remainder

Program 1

In this program, the user initialize two integer numbers using two variables as num1 and num2 and then the program calculates the quotient and remainder of the given numbers using division and modular operator

num1=40
num2=6
quotient=num1/num2
remainder=num1%num2
print("Quotient is: ",quotient);
print("remainder is: ",remainder);

When the above code is executed, it produces the following result

Quotient is:  6
remainder is:  4

 

Program to find quotient and remainder-Entered by user

Program 2

the program allows to enter two integer and then the program calculates the quotient and remainder of the given numbers respectively using division and modular operator

num1=int(input("Enter the first number: "))
#Ask input from the user and reading the input for num1
num2=int(input("Enter the first number: "))
#Ask input from the user and reading the input for num2
quotient=num1/num2
#Calculate quotient
remainder=num1%num2
#Calculate remainder
print("Quotient is: ",quotient);
#displayt quotient
print("Remainder is: ",remainder);
#display remainder

When the above code is executed, it produces the following result

Enter the first number100
Enter the first number7
Quotient is:  14
Remainder is:  2

 

Suggested for you

Operator in Python

Data types in Python

Function in Python language

Introduction of Python Language

Recursion in Python language

 

Similar post

C Program to Divide of two integer numbers

Java Program to Divide of two integer numbers

C++ Program to Divide of two integer numbers

Python Program to Divide of two integer numbers

 

C Program to Divide of two integer numbers using function

Java Program to Divide of two integer numbers using method

C++ Program to Divide of two integer numbers using function

Python Program to Divide of two integer numbers using function

C++ Program to compute Quotient and Remainder
Java exercise to calculate division of two floating point numbers
Exit mobile version