#include int main(void) { /* c will contain the character we read in */ char c; /* cr is just used to read in the user hitting enter, we ignore its value */ printf("You typed %c\n", c); char cr; printf("Type y or n:"); scanf("%c%c", &c, &cr); /* Note when comparing characters, you must put the character in single quotes */ if (c == 'y') { printf("You typed yes\n"); } else if (c == 'n') { printf("You typed no\n"); } else { printf("You typed an invalid character\n"); } return(0); }