comparing ceil, floor, round, abs function values – CSKC
Sign In

Search

Solved Problem #CPP#5330    siteicon   siteicon  

Problem Statement - comparing ceil, floor, round, abs function values

Which of the following math function will return the lowest number as output. Also write output of all functions.

(i) ceil(5.1)
(ii) floor(5.9)
(iii) round(5.99)
(iv) abs(-6)

Solution

TC++ #5330

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

(ii) floor(5.9) will give lowest output as 5. All others will give 6.

Notes

ceil(5.1)
This will be 6 as ceil() raises a value to its nearest higher integer.

floor(5.9)
This will be 5 as floor() downgrades a value to its nearest lower integer.

round(5.99)
This will be 6 as nearest rounded integral value of 5.99 would be 6.

abs(-6)
This will also be 6 as – sign will be removed by abs


Share

Created: 8-Dec-2018 21:48 | Updated: 22-Mar-2026 20:20|