Answers for "c program to using switch to determine whether entered number is either 0, 1 or 2"

0

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;
    }
}
Posted by: Guest on April-22-2021

Code answers related to "c program to using switch to determine whether entered number is either 0, 1 or 2"

Browse Popular Code Answers by Language