Basic Switch Case
In this, we are going to see a very basic program of Switch case in C Programming in which we are going to just print the case only.



#include <stdio.h>
int main()
{
    int val;
    printf("Enter a number from 1 to 4 to select the case\n");
    scanf("%d", &val);

    switch (val)
    {
    case 1:
        printf("You selected Case 1\n");
        break;

    case 2:
        printf("You selected Case 2\n");
        break;

    case 3:
        printf("You selected Case 3\n");
        break;

    case 4:
        printf("You selected Case 4\n");
        break;

    default:
        printf("Oops!! Your input is not accepted.\n");
        break;
    }

    return 0;
}

//.............Coded by YASH ALLAPURIA

#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post