Write a program in C using switch case statement (Part-2)
Write a program in 'C' to enter an alphabet A or S or C and to print:-
Arts student for A,
Science student for s,
Commerce student for c,
and any other alphabet print not a student.
For eg :-
Output:-
Enter any alphabet form A , S , C
Commerce student
Arts student for A,
Science student for s,
Commerce student for c,
and any other alphabet print not a student.
#include< #include< #include< void main() { char a; printf("\n Enter any alphabet form A , S , C \n"); a = getchar( ); switch(a) { case 'A' : printf("\n Arts student \n"); break; case 'S' : printf("\n Science student \n"); break; case 'C' : printf("\n Commerce student \n"); break; default : printf("\n Not a student \n"); } } |
---|
For eg :-
Output:-
Enter any alphabet form A , S , C
Commerce student
0 comments:
Post a Comment