Dremendo Tag Line

Input alphabet check vowel or not using switch case in C

switch case - Question 2

In this question, we will see how to input an alphabet in lowercase and check if it is a vowel or not in C programming using the switch case statement. To know more about switch case statement click on the switch case statement lesson.

Q2) Write a program in C to input an alphabet in lowercase and check if it is a vowel or not using the switch case statement.

Program

#include <stdio.h>
#include <conio.h>

int main()
{
    char c;
    printf("Enter an alphabet in lowercase ");
    scanf("%c",&c);
    switch(c)
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
            printf("Vowel");
            break;

        default:
            printf("Not a vowel");
    }
    return 0;
}

Output

Enter an alphabet in lowercase i
Vowel
video-poster