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

Please write a code and a answer of the question below. Write a C program that p

ID: 3789626 • Letter: P

Question

Please write a code and a answer of the question below.

Write a C program that prompts the user to enter three integers a, b, c, and then computes the results of the following logical operations, in sequence:

!a || !b++ && c

(a-1 || b/2) && (c*=2)

(a-- || --b) && (c+=2) a || !(b && --c)

Here are three sample runs of this a program.

-----------------------------------

Enter 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 integers a, b, c: -7 42 0

!a || !b++ && c: False

(a-1 || b/2) && (c*=2): False

(a-- || --b) && (c+=2): True

a || !(b && --c): True

---------------------------------

Enter integers a, b, c: 10 0 1000

!a || !b++ && c: True

(a-1 || b/2) && (c*=2): True

(a-- || --b) && (c+=2): True

a || !(b && --c): True

--------------------------------------------

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 backwards)

Explanation / Answer

#include<stdio.h>

int main()
{
   //declare variable a, b , c
   int a, b, c;

   //ask user to input
   printf("Enter three integers a, b, c: ");
   scanf("%d%d%d", &a, &b, &c);

   if (!a || !b++ && c)
       printf(" !a || !b++ && c: True ");
   else
       printf(" !a || !b++ && c: False ");
  
   if ((a - 1 || b / 2) && (c *= 2))
       printf("(a - 1 || b / 2) && (c *= 2): True ");
   else
       printf("(a - 1 || b / 2) && (c *= 2): False ");

   if ((a-- || --b) && (c += 2))
       printf("(a-- || --b) && (c += 2): True ");
   else
       printf("(a-- || --b) && (c += 2): False ");

   if (a || !(b && --c))
       printf("a || !(b && --c): True ");
   else
       printf("a || !(b && --c): False ");

}

------------------------------------------------------------------------------------------------------

//output1

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

//output2:

Enter three integers a, b, c: -7 42 0
!a || !b++ && c: False
(a - 1 || b / 2) && (c *= 2): False
(a-- || --b) && (c += 2): True
a || !(b && --c): True

----------------------------------------------------

//output3:

Enter three integers a, b, c: 10 0 1000
!a || !b++ && c: True
(a - 1 || b / 2) && (c *= 2): True
(a-- || --b) && (c += 2): True
a || !(b && --c): True