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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started