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/Lectures/LC8/Switch1/switch_1.c

31 lines
547 B
C
Raw Permalink Normal View History

/* MMME3085 Chapter 8 */
2022-04-07 15:58:01 +00:00
/* Example of a simple if statements */
#include <stdio.h> /* Standard include files */
#include <stdlib.h>
int main( void )
{
int a; /* Define an int */
scanf ("%d",&a); /* Get value */
switch (a) /* Start of switch */
{
case 1:
printf("Hi"); /* Case 1 */
break;
case 2:
printf("Bye"); /* Case 2 */
break;
default :
printf("Err"); /* Default */
break;
}
return 0;
}