#include <stdio.h>
int
main (void)
{
char color;
do
{
printf ("Enter the color of the light (R,G,Y,A): ");
scanf (" %c", &color);
}while (color!='R' && color!='r' && color!='G' && color!='g'
&& color!='Y' && color!='y' && color!='A' && color!='a');
switch (color)
{
case 'R':
case 'r':
printf ("STOP! \n");
break;
case 'Y':
case 'y':
case 'A':
case 'a':
printf ("CAUTION! \n");
break;
case 'G':
case 'g':
printf ("GO! \n");
break;
}
return (0);
}
Enter the color of the light (R,G,Y,A): b
Enter the color of the light (R,G,Y,A): x
Enter the color of the light (R,G,Y,A): G
GO!