Question: Write a program that reads in two floating-point numbers and tests (a) whether they are the same when rounded to three decimal places and (b)

 Write a program that reads in two floating-point numbers and tests

Write a program that reads in two floating-point numbers and tests (a) whether they are the same when rounded to three decimal places and (b) whether they differ by less than 0.001. Sample Inputs (in Red) /Outputs: Sample 1: Enter two double numbers: 1.00.99998 They are the same when rounded to three decimal places. They differ by less than 0.001. Sample 2: Enter two double numbers: 0.99910.999999 They are different when rounded to two decimal places. They differ by less than 0.001. Sample 3: Enter two double numbers: 0.98760.93212 They are different when rounded to two decimal places. They differ by greater than 0.001

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!