Home »
Python »
Python Programs
Python program to find floor division
Floor division in Python: Here, we are going to learn how to find floor division using floor division (//) operator in Python?
By IncludeHelp Last updated : September 17, 2023
Overview
When we divide a number by another number – division operator (/) return quotient it may be an integer or float. But, when we need quotient without floating number – we can floor division (//) operator, it returns quotient (result) without floating points.
Floor Division
In Python, the floor division operator is double slash (//) which is also known as integer division. The floor division operator divides the first operand by the second and rounds the result down to the nearest integer.
Example
Let suppose there are two numbers 10 and 3. Their floor division (10//3) will be 3.
Input:
a = 10, b = 3
# Division
resul = a/b
Output:
3.3333333333333335
Input:
a = 10, b = 3
# Floor Division
resul = a//b
Output:
3
Python program to find floor division
# python program to find floor division
a = 10
b = 3
# finding division
result1 = a/b
print("a/b = ", result1)
# finding floor division
result2 = a//b
print("a/b = ", result2)
Output
a/b = 3.3333333333333335
a/b = 3
Python Basic Programs »