Homework4-1

# Homework4-1 - Y2 | Z1 Z2\n");

This preview shows pages 1–2. Sign up to view the full content.

Homework #4 /* * Program: hw4_1 * Written by Justin Waters * Inputs: none * Outputs: truth table * Description: This program verifies DeMorgan's Theorem by producing a truth table*/ #include <stdio.h> //defined printf, scanf int main (void) { int X1, X2, Y1, Y2, Z1, Z2; //used for printed values //prints the top of the truth chart printf("A B | Y1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Y2 | Z1 Z2\n"); printf("------------------------\n"); for (X1=0;X1<2;++X1){ //loops for the comparison values Y1 = !(X1 || X2); Y2 = !X1 && !X2; for (X2=0;X2<2;++X2){ Z1 = !(X1 && X2); Z2 = !X1 || !X2; //prints the values in the truth table printf("%d %d | %d %d | %d %d\n", X1, X2, Y1, Y2, Z1, Z2);} } return (0); }...
View Full Document

## This note was uploaded on 08/06/2008 for the course EGR 261 taught by Professor Parikh during the Spring '08 term at Grand Valley State University.

### Page1 / 2

Homework4-1 - Y2 | Z1 Z2\n");

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online