CHALLENGE 3.17.1: Floating-point comparison: Print Equal or Not equal. ACTIVITY Write an expression that will cause the

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

CHALLENGE 3.17.1: Floating-point comparison: Print Equal or Not equal. ACTIVITY Write an expression that will cause the

Post by answerhappygod »

Challenge 3 17 1 Floating Point Comparison Print Equal Or Not Equal Activity Write An Expression That Will Cause The 1
Challenge 3 17 1 Floating Point Comparison Print Equal Or Not Equal Activity Write An Expression That Will Cause The 1 (80.98 KiB) Viewed 43 times
Challenge 3 17 1 Floating Point Comparison Print Equal Or Not Equal Activity Write An Expression That Will Cause The 2
Challenge 3 17 1 Floating Point Comparison Print Equal Or Not Equal Activity Write An Expression That Will Cause The 2 (93.23 KiB) Viewed 43 times
In C language.
CHALLENGE 3.17.1: Floating-point comparison: Print Equal or Not equal. ACTIVITY 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". Hint: Use epsilon value 0.0001. Ex: If targetValue is 0.3333 and sensorReading is (1.0/3.0), output is: Equal 415226.2573686.qx3zqy7 1 #include 2 #include 3 4 int main(void) { 5 6 7 8 scanf("%lf", &targetValue); 9 scanf("%lf", &sensorReading); 10 11 12 134 15 16 double targetValue; double sensorReading; Run if * Your solution goes here * { printf("Equal\n"); } else { } printf("Not equal\n"); ▬ 1 test passed All tests passed
CHALLENGE 4.9.2: Simon says. ACTIVITY "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Assume simon Pattern and userPattern are always the same length. Ex: The following patterns yield a userScore of 4: simonPattern: RRGBRYYBGY userPattern: RRGBBRYBGY 415226.2573686.qx3zqy7 1 #include 2 #include 3 4 int main(void) { 5 char simonPattern [50]; 6 char userPattern [50]; 7 int userScore; 8 int i; 9 10 11 12 13 14 15 Run userScore = 0; scanf("%s", simonPattern); scanf("%s", userPattern); * Your solution goes here */ DID 1 test passed All tests passed
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply