
Concept explainers
(Rounding Numbers) Function floor can be used to round a number to a specific decimal place. The statement
Y = floor (x * 10 + 0.5) /10:
rounds x to the tenths position (the first position to the right of the decimal point). The statement
Y = floor (x * 100 + 0.5) /100:
rounds x to the hundredths position (the second position to the right of the decimal point). Write
a) roundTolnteger(number)
b) roundToTenths (number)
c) roundToHundredths(number)
d) roundToThousandths (number)
For each value read, your program should print the original value the number rounded to number rounded to the neatest integer, the number rounded to the nearest tenth, the number rounded to the hundred and the number rounded to the nearest thousandth.

Trending nowThis is a popular solution!

Chapter 6 Solutions
C++ How to Program (10th Edition)
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning



