Question: Modify the given program to create and display truth tables for the following Boolean functions: b1||b2||b3||b4 !(!b1 || b2) && (!b3 || b4) Two unique
Modify the given program to create and display truth tables for the following Boolean functions:
b1||b2||b3||b4 !(!b1 || b2) && (!b3 || b4) Two unique functions of your choice which use all variables b1-b4 with some
combination of operators.
/* Print a table of values for some boolean functions. */
#include
int main(void)
{
int b1, b2, b3, b4, b5; /* boolean variables */
int cnt = 0;
printf(" %5s%5s%5s%5s%5s%5s%7s%7s%11s ", /* headings */
"Cnt", "b1", "b2", "b3", "b4", "b5",
"fct1", "fct2", "majority");
for (b1 = 0; b1 <= 1; ++b1)
for (b2 = 0; b2 <= 1; ++b2)
for (b3 = 0; b3 <= 1; ++b3)
for (b4 = 0; b4 <= 1; ++b4)
for (b5 = 0; b5 <= 1; ++b5)
printf("%5d%5d%5d%5d%5d%5d%6d%7d%9d ",
++cnt, b1, b2, b3, b4, b5,
b1 || b3 || b5, b1 && b2 || b4 && b5,
b1 + b2 + b3 + b4 + b5 >= 3);
putchar(' ');
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
