This repository has been archived on 2023-10-26. You can view files and clone it, but cannot push or open issues or pull requests.
VSMechatronics/Exercises/C8/switch_example_1.c

29 lines
559 B
C
Raw Normal View History

2022-04-08 15:12:38 +00:00
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
// Declare some variables
int a = 1;
switch ( a )
{
case 0 :
printf ("Sunday\n");
break ; // end of the lines of code to execute
case 1:
printf ("Monday\n");
break ; // end of the lines of code to execute
case 2:
printf ("Tuesday\n");
break ; // end of the lines of code to execute
// etc...
default: // If no case is met (OPTIONAL)
printf ("\nThe value supplied is out of range\n");
}
return 0;
}