switch case in C.

 

01 #include<stdio.h>
02
03 int main()
04 {
05 int i;
06 printf("Enter any No. (1 to 5) : ");
07 scanf("%d",&i);
08
09 switch(i)
10 {
11 case 1:
12 {
13 printf("You enter ONE");
14 break;
15 }
16 case 2:
17 {
18 printf("You enter TWO");
19 break;
20 }
21 case 3:
22 {
23 printf("You enter THREE");
24 break;
25 }
26 case 4:
27 {
28 printf("You enter FOUR");
29 break;
30 }
31 case 5:
32 {
33 printf("You enter FIVE");
34 break;
35 }
36 default:
37 {
38 printf("Invalid number");
39 }
40 }//end of switch
41
42 }
 
 
OUTPUT :

Enter any No. (1 to 5) : 4
You enter FOUR

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.