/* File: demorgan.c Demonstrating DeMorgan's Law */ #include int main() { char onions, anchovies, cr ; printf("Does this pizza have onions (y/n) ?") ; scanf("%c%c", &onions, &cr) ; printf("Does this pizza have anchovies (y/n) ?") ; scanf("%c%c", &anchovies, &cr) ; // I won't eat it, if it has either onions or anchovies if (onions == 'y' || anchovies == 'y') { printf("I hate this pizza!\n") ; } else { printf("Yum!!\n") ; } // Me either if (! (onions == 'n' && anchovies == 'n') ) { printf("I hate this pizza, too!\n") ; } else { printf("I'm hungry!\n") ; } return 0 ; }