Question: #include int main() { int a, b, z; ________ operator; /* character that stores users choice */ printf(Enter '&' or '|':); scanf(%c, ______________); /* user

#include

int main()

{

int a, b, z;

________ operator; /* character that stores users choice */

printf("Enter '&' or '|':");

scanf("%c", ______________); /* user chooses AND or OR */

printf("A B Z "); /* print truth table heading */

for(___________; ___________; ___________)

{

for(___________; ___________; ___________)

{

if(operator ______ '&') /* if user chose AND */

z = a & b;

else /* else user chose OR */

z = a | b;

/* print a truth table row and a newline character */

printf("_______________________", a, b, _________);

}

}

return 0;

}

Complete the program above that prints one of the truth tables shown below, depending on whether the user enters the character & or |, respectively:

A B Z

0 0 0

0 1 0

1 0 0

1 1 1

or

A B Z

0 0 0

0 1 1

1 0 1

1 1 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!