Chapter 7 – Functions

Classs #11 – Chapter #7 – Q #2:
How is math.ceil(89.7) different from math.floor (89.7)?
math.ceil(89.7): This function returns the smallest integer that is greater than or equal to 89.7. Therefore, the output is 90. It effectively rounds the number up to the nearest whole number
math.floor(89.7): Conversely, this function returns the largest integer that is less than or equal to 89.7. Hence, the output is 89. It rounds the number down to the nearest whole number
Summary:
Function | Input | Output |
math.ceil() | 89.7 | 90 |
math.floor() | 89.7 | 89 |
NCERT Computer Science Class 11 Chapter 7 Solutions Q 2