The ceil()
function returns the nearest smallest integer greater than or equal to a number. Figure 1 shows the mathematical representation of the ceil()
function.
The
math
module is required for this function.
ceil(number)
This function requires a number to round up as a parameter.
ceil()
returns the nearest smallest integer greater than or equal to a number sent as a parameter.
import math#positive integer sent as parameterprint "ceil(10) : ", math.ceil(10)#negative integer sent as parameterprint "ceil(-10) : ", math.ceil(-10)#positive float value sent as parameterprint "ceil(2.1) : ", math.ceil(2.1)#negative float value sent as parameterprint "ceil(-2.1) : ", math.ceil(-2.1)