floor() function in python by R4R Team

floor() is a python build-in function which is defined in math library and its work to find the lowest bound of the number.
Example-
number is 2.3
floor will 2

number is 45.6
floor will 45

program-

import math
print("Enter any number")
n=float(input())
print("Floor is "+str(math.floor(n)))
print(type(n))
print(type(math.floor(n)))


output-

Enter any number
3.2
Floor is 3
<'class 'float'>
<'class 'int'>

Enter any number
-2.4
Floor is -3
<'class 'float'>
<'class 'int'>

-In this program, we take input of float number and try to find the floor of that number which is the lowest or equal integer of that number.
- It define in the math library so we import the math library by writing the statement import math.

Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!