Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Why is this not working? What am i missing? ID learn ? zyBooks My library > EGR

ID: 3908481 • Letter: W

Question

Why is this not working? What am i missing?

ID learn ? zyBooks My library > EGR 219 home-20.16: Floating-point comparison zyBooks catalog Help/FAQ Dennis Roberts CHALLENGE ACTIVITY 20.16.1: Floating-point comparison: Print Equal or Not equal Write an expression that will cause the following code to print 'Equal if the value of sensorReading is 'close enough to targetValue. Otherwise, print "Not equal" 1 include 2 #include«nath.h> 4 int mainCvoid) t S double targetValue; 6 double sensorReading; 8 targetValue03333; 9 sensorReading 1.8/3.0; 10 11 if Cabs(sensorReading-targetValue)0.001/ Your solution goes here) 12 13 14 else [ 15 16 17 18 return 0; printf"Equal ); printfC"Not equal " Run Testing with targetValue 0.3333, sensorReading 1.0/3. Your output Equal X Testing with targetValue 0.3333, sensorReading 2.0/3.0 Output differs. See highlights below. Special character legend Your output Equal Expected output Not equal

Explanation / Answer

scanf("%lf", &targetValue); scanf("%lf", &sensorReading); use these instead of initializing targetValue and sensorReading manually to 0.3333 and 1.0/3.0;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote