## ceil() function of the math module

### This function will return the ceiling value of the number passed as a parameter.Ceiling value is the smallest integer greater than or equal to the given number.math.ceil(x)

For example :

1. Ceiling value of 11.7 is 12

The smallest integer greater than 11.7 is 12.

2. Ceiling value of 12 is 12.

12 is an integer and the smallest integer is equal to 12.

3. Ceiling value of 12.3 is 13

#### Parameters:

• It will take only one parameter: ceil(x)

• required parameter

• x must be a number you want to round to its ceiling value.

• If x is not a number then TypeError occurs.

#### Return Type:

In Python3.x

Return an integer which denotes the ceiling value

In Python2

Return a float value which denotes the ceiling value

#### Sample program (Python3.x):

import math
returnValue1=math.ceil(11.7) # return the ceiling value
returnValue2=math.ceil(
12)
returnValue3=math.ceil(
12.3)
print(
"Ceiling value of 11.7 is : ",returnValue1)
print(
"Ceiling value of 12 is : ",returnValue2)
print(
"Ceiling value of 12.3 is : ",returnValue3)

#check the return type
print(type(returnValue1))
print(type(returnValue2))
print(type(returnValue3))

Output :

Ceiling value of 11.7 is : 12
Ceiling value of 12 is : 12
Ceiling value of 12.3 is : 13
<class 'int'>
<class 'int'>
<class 'int'>

If parameter passed is not a number then TypeError will occur

#### More Articles of MOHIT RAJ:

Name Views Likes
Python http HTTPStatus 926 3
Python SimpleHTTPServer 441 3
Python math cos 556 3
Python math sin 580 3
Python math atanh 255 3
Python csv reading function 328 3
Python math isnan 441 3
Python math log() 477 3
Python math log2 407 3
SQLite3 in python - part2 255 3
Python math degrees 238 3
Python math ldexp 256 3
Python math tanh 346 3
Python math tan 563 3
Python math Introduction 307 4
Python math comb 1088 3
Python math asinh 237 3
SQLite3 in python - part1 315 3
Implementing a text to speech program in python using gTTS 1494 3
Python csv writing function 323 3
Python math acosh 249 3
Python math trunc 463 3
Python math asin 330 3
Python math copysign 346 3
Python math erf 354 3
Python math cosh 286 3
Python math log10 368 3
Python math dist 606 3
Implementing a text to speech program in python using gTTS 87 1
Python webbrowser get 259 3
Python webbrowser open 340 3
Python math isclose 769 3
Python webbrowser introduction 249 3
Python project - Play with snake 815 1
Python math isfinite 266 3
Python math acos 377 3
Python math exp 648 3
Python math fmod 336 3
Python csv introduction 295 3
Python math log1p 278 3
Python math pow 378 3
Rechecking of website 258 0
Python math perm 427 3
Python math gcd 445 3
Python math floor() 359 3
Python math sinh 274 3
Python math isqrt 468 3
Python math fabs 287 3
Python math factorial() 407 3
Online Interview Tips 335 3
Python math sqrt 567 3
Python math atan 432 3
Python webbrowser open_new 258 3
Python math frexp 264 3
Python math ceil 510 3
python math expm1 262 3
How to Check the Internet Connection in Python 2086 3
Python math isinf 396 3
Python math atan2 390 3
Python webbrowser open_new_tab 274 3