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/C8/switch_example_1.c
2022-04-08 16:12:38 +01:00

29 lines
559 B
C

#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;
}