Question: Write down the following two functions with the specified task mentioned beside each. Assume that always a negative value will be supplied in the parameter

Write down the following two functions with the specified task mentioned beside each. Assume that always a negative value will be supplied in the parameter x of both of the functions. You are not allowed to use any branching or repetition statement(s) to perform these tasks. (i) int truncate (float x) discards the fractional part and returns the integer. (ii) int rounding (float x) returns the nearest integer. In case of tie, it returns the larger one. (iii) int ceiling (float x) returns the smallest integer not less than x.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!