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
Get step-by-step solutions from verified subject matter experts
