How to use 'Switch' in C programming.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char grade;
printf("Enter the character : \n");
scanf("%c",&grade);
switch(grade){
case 'A': printf("Hail Hitler! \n");
break;
case 'B': printf("Hail 3rd Reich! \n");
break;
case 'C': printf("Die! \n");
break;
case 'D': printf("Emperor Hirohito! \n");
break;
case 'F': printf("Death to the miscreants! \n");
break;
default : printf("Hail Churchil! \n");
}
return 0;
}
Comments
Post a Comment