I need the extra credit part and how you get the numbers with clear explanation
ID: 3603377 • Letter: I
Question
I need the extra credit part and how you get the numbers with clear explanation
Problem 1. Write a C program, called logicabc.c, that prompts the user to enter three integers a, b, c, and then computes the results of the following logical operations, in sequence (a-1 b/2) && (c 2) Here are three sample runs of this a program, assuming that the executable file is called logicabc /home/userXYZ/ECE15/Labl> logic aboc Enter integers a, b, c1 1 1 (a-1 b/2) && (C2) True (a-- II-b) && (c+-2): True a !! ! (b &&-c) : False /home/userXYZ/ECE15/Labl> logic abc Enter integers a, b, c 7 42 0 !a I!b++ && C: False (a-1 II b/2)&&(C2): False (a-- II-b) && (c+-2): True a II ! (b &&-c) : True /home/userXYZ/ECE15/Labl> logicabc Enter integers a, b, c: 100 1000 (a-1 b/2) && (C2) True (a-- II-b) && (c+-2): True a II ! (b &&-c) : True Extra Credit (15 points) Are there values of a, b, and c that would make all the results False? Submit your answer to this question as a comment in your program. Please explain clearly how you have arrived at this answer. Hint: It may be useful to start with the last expression and work backwardsExplanation / Answer
If you give inputs as follows:
Enter three integers a, b, c: 1 1 1
!a||!b++ && c: False
(a - 1||b / 2) && (c *= 2): True
(a-- || --b) && (c += 2): True
a || !(b && --c): False
Enter three integers a, b, c: 1 -2 1
!a||!b++ && c: False
(a - 1||b / 2) && (c *= 2): False
(a-- || --b) && (c += 2): True
a || !(b && --c): False
Enter three integers a, b, c: 1 -2 -2
!a||!b++ && c: False
(a - 1||b / 2) && (c *= 2): False
(a-- || --b) && (c += 2): False
a || !(b && --c): False
As you can see, the third condition will gets false, if and only if c=-2.
Then second condition will gets false if and only a=1 and b=-2
If a=1, then first two conditions will gets false
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.