Rounding numbers an application of function floor is


Question: (Rounding Numbers) An application of function floor is rounding a value to the nearest integer. The statement

y = floor(x + .5);

will round the number x to the nearest integer and assign the result to y. Write a program that reads several numbers and uses the preceding statement to round each of these numbers to the nearest integer. For each number processed, print both the original number and the rounded number.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Rounding numbers an application of function floor is
Reference No:- TGS02403949

Now Priced at $15 (50% Discount)

Recommended (97%)

Rated (4.9/5)