/* Example program #2 from Chapter 12 of Absolute Beginner's Guide
to C, 3rd Edition
File Chapter12ex2.c */
/* This program asks for a last name. If the name starts with a
letter between P and S, the user goes to a special room. */
#include <stdio.h>
main() {
char name[25];
printf("What is your last name? ");
printf("(Please capitalize the first letter!)\n");
scanf(" %s", name);
if ((name[0] >= 'P') && (name[0] <= 'S')) {
printf("You must go to room 2432 ");
printf("for your tickets.\n");
}
else {
printf("You can get your tickets here.\n");
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: