Write a program in 'C' using switch case statement.
Write a program in C where the numbers 1,2,3 represent first,second and Third Class & the no. 4 represent fail or any other number print not suitable.
For eg :-
Output :-
Enter any integer from 1 to 4
1
First Class
#include< #include< #include< main() { int n; printf("Enter any integer from 1 to 4 \n"); scanf("%d", &n); switch(n) { case 1: printf("\n First Class \n"); break; case 2: printf("\n Second Class \n"); break; case 3: printf("\n Third Class \n"); break; case 4: printf("\n Fail \n"); break; default : printf("\n Not Suitable \n"); } return(0); } |
---|
For eg :-
Output :-
Enter any integer from 1 to 4
1
First Class
0 comments:
Post a Comment