Question: The function floor may be used to round numbers to a specific decimal place. The statement: y = floor(x + .5); will round the number
The function floor may be used to round numbers to a specific decimal place. The statement: y = floor(x + .5); will round the number x to the nearest integer and assign the value to y y = floor(x*10 + .5); will round the number x to the nearest tenth position and assign the value to y y = floor(x*100 +.5); will round the number x to the nearest hundredth position and assign the value to y Write a program that defines four functions to round a number x in various ways: a) roundToInteger(number) b) roundToTenths(number) c) roundToHundredths(number) d) roundToThousands (number) For each value read your program should print the original value. The program should give the option to the user what operation wants to perform. Your program should include: proper case, variable names(meaningful and use conventions) proper organization, indentation, white space, and comments Has the right inputs and outputs, computes correct results. is efficient Use a loop that gives the user the option of do another calculation or quit. Submit the .c file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
