In Exercise 7.2, you modified the round.html page so that it rounded the number to two decimal
Question:
In Exercise 7.2, you modified the round.html page so that it rounded the number to two decimal places instead of 1. This involved multiplying the number by 100 (instead of 10), rounding to the nearest integer, then dividing by 100 (instead of 10). This process can be generalized to any number of decimal places, by using the appropriate power of 10. In order to round a number to N digits, you multiply that number by 10N, round to the nearest integer, then divide by 10N.
Modify your round.html page so that it has an additional text box where the user can specify the number of digits. When the button is clicked, the number in the original text box will be rounded to the specified number of digits and displayed in the page?
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Question Posted: