Question: I can't hardcode of use inbuilt libraries /** * @param val (assume val is more than or equal to zero) * @return floor of val
I can't hardcode of use inbuilt libraries
/** * @param val (assume val is more than or equal to zero) * @return floor of val * floor of a floating-point value is defined as the highest integer * that is less than or equal to the value. * For example, floor(4.2) = 4, floor(7.0) = 7, floor(5.9999) = 5 */ public int floor(double val) { if(val >= 0) { } return floor(0); }
/** * * @param val (assume val is more than or equal to zero) * @return ceiling of val * ceiling of a floating-point value is defined as the smallest integer * that is more than or equal to the value. * For example, ceiling(4.2) = 5, ceiling(7.0) = 7, * ceiling(5.9999) = 6, ceiling(-3.7) = -3 */ public int ceiling(double val) { if (val <= 0) { } return ceiling(0.0); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
