Switch Statement in C Programming
Source code for this Tutorial
#include <stdio.h> #include <stdlib.h> int main() { char grade; printf("Enter your grade\n"); grade = getch(); switch(grade){ case 'a': case 'A': printf("You got the grade A\nAll the Best\n"); break; case 'b': printf("You got the grade B\nAll the Best\n"); break; case 'c': printf("You got the grade B\nAll the Best\n"); break; default: printf("Unknown grade entered\n"); } printf("Done Grading!"); return 0; }