Chapter 6: Problem 9
Math.floor can be used to round values to the nearest integer—e.g., y = Math.floor(x + 0.5); will round the number x to the nearest integer and assign the result to y. Write an application that reads double values and uses the preceding statement to round each of the numbers to the nearest integer. For each number processed, display both the original number and the rounded number.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.