Question: Using the code below as a starting point, write a program to print the K-map for a 4 variable function. Demonstrate that it works using
Using the code below as a starting point, write a program to print the K-map for a 4 variable function. Demonstrate that it works using f(w,x,y,z) = w'x + x'y + y'z + z'w and g(w,x,y,z) = x'y + wx'y'z + z' as examples. Submit the printed source code and the printout of the output of the program for the above function examples. Your program should only print the K-map using the above functions: there is no need for user input. Starter Code :- #include int main() { unsigned int a, b, c, d; unsigned int f; /* Print header for K-map. */ printf(" bc "); printf(" 00 01 11 10 "); printf(" ______________ "); /* row-printing loop */ for (a = 0; 2 > a; a = a + 1) { printf("a=%u | ", a); /* Loop over input variable b in binary order. */ for (b = 0; 2 > b; b = b + 1) { /* Loop over d in binary order.*/ for (d = 0; 2 > d; d = d + 1) { /* Use variables b and d to calculate * * input variable c (iterated in * * Gray code order). */ /* CALCULATE c HERE. */ /* Calculate and print one K-map entry * * (function F(a,b,c) ). */ /* INSERT CODE HERE. */ } } /* End of row reached: print a newline character. */ printf(" "); } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
