c program to using switch to determine whether entered number is either 0, 1 or 2 code example
Example: c program to using switch to determine whether entered number is either 0, 1 or 2
#include <stdio.h>
int main(){
int num;
printf("Enter a number: \n");
scanf("%d", &num);
switch(num){
case 0:
printf("You Entered 0\n");
break;
case 1:
printf("You Entered 1\n");
break;
case 2:
printf("You Entered 2\n");
break;
default:
printf("Out of range!\n");
break;
}
}