Python | math.ceil() function
Improve
In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.ceil() function returns the smallest integral value greater than the number. If number is already integer, same number is returned.
Syntax: math.ceil(x) Parameter: x: This is a numeric expression. Returns: Smallest integer not less than x. Time Complexity: O(1) Auxiliary Space: O(1)
Code #1:
Python3
# Python code to demonstrate the working of ceil() # importing "math" for mathematical operationsimport math x = 33.7 # returning the ceil of 33.7print ("The ceil of 33.7 is : ", end ="")print (math.ceil(x)) |
Output:
The ceil of 33.7 is : 34
Code #2:
Python3
# Python code to demonstrate the working of ceil() # importing "math" for mathematical operationsimport math # prints the ceil using ceil() methodprint ("math.ceil(-13.1) : ", math.ceil(-13.1))print ("math.ceil(101.96) : ", math.ceil(101.96)) |
Output:
math.ceil(-13.1) : -13 math.ceil(101.96) : 102
Don't miss your chance to ride the wave of the data revolution! Every industry is scaling new heights by tapping into the power of data. Sharpen your skills and become a part of the hottest trend in the 21st century.
Dive into the future of technology - explore the Complete Machine Learning and Data Science Program by GeeksforGeeks and stay ahead of the curve.
Share your thoughts in the comments

