#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 */ char cr; /* Get an initial integer or double, also storing the enter character */ int value; printf("Type in an integer: "); scanf("%d%c", &value, &cr); printf("You typed %d\n", value); 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); }