Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 (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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started