1.

Differentiate ceil ( ) and floor ( ) function?

Answer»
functionDescriptionsyntaxExample
floor ( )Returns the largest integer less than or equal to xx = 26.7
y = -26.7
z = 23.2
Print(math.floor(x))
Print(math.floor(y))
Print(math.floor(z))
Output:
26
-27
-24
ceil ( )Returns the smallest integer greater than or equal to xx = 26.7
y = -26.7
z = 23.2
Print(math.ceil(x))
Print(math.ceil(y))
Print(math.ceil(z))
Output:
27
-26
-23


Discussion

No Comment Found