C - Programming Language
This course covers the basics of programming in C. Work your way through the videos and we'll teach you everything you need to know to start your programming journey!

Switch Statements

Lesson 20
Author : Mike Dane
Last Updated : November, 2017


Code

Copychar myGrade = 'A';
switch(myGrade){
     case 'A':
          printf("You Pass\n");
          break;
     case 'F':
          printf("You fail\n");
          break;
     default:
          printf("Invalid grade\n");
}