CBSE Class 11 Computer Science Question 43 of 63

Introduction to Python Modules — Question 12

Back to all questions
12
Question

Question 12

How is math.ceil(89.7) different from math.floor(89.7)?

Answer

The math.ceil(x) returns the smallest integer greater than or equal to x. In other words, it rounds up to the nearest integer. For 89.7, the smallest integer greater than 89.7 is 90. While math.floor(x) returns the largest integer less than or equal to x. In other words, it rounds down to the nearest integer. For 89.7, the largest integer less than 89.7 is 89.