initial import
[staff/goc4/2018bti7061.git] / c-2-controlStructures / examples / controlStatements / switches.c
1 #include <stdio.h>
2
3 main(){
4 puts("--------------------------");
5 puts("Examples with SWITCH");
6
7 puts("Enter one letter for a color (RWB):");
8 char choice;
9 choice = getchar();
10
11 switch(choice){
12 case 'r':
13 case 'R':
14 printf("Red");
15 break;
16 case 'w':
17 case 'W':
18 printf("White");
19 break;
20 case 'b':
21 case 'B':
22 printf("Blue");
23 break;
24 default:
25 printf("Not a valid color");
26
27 }
28
29 putchar('\n');
30
31 }