Home » Blog » Check If Input Character Is A Vowel Using Switch Case

Check If Input Character Is A Vowel Using Switch Case

The below program is check the entered character, if it is vowel then it will print the entered character is vowel, otherwise it will print that the entered character is not vowel.

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

void main()
{
    char ch;
	
    clrscr();
	
    printf("Enter A Character :  ");
    scanf("%c", &ch);

    switch(ch)
    {
        case 'a':
        case 'A':
        case 'e':
        case 'E':
        case 'i':
        case 'I':
        case 'o':
        case 'O':
        case 'u':
        case 'U':
            printf("\n\n%c is a Vowel.\n\n", ch);
            break;
        default:
            printf("%c is not a Vowel.\n\n", ch);
    }
    
    getch();
}

OutPut

Enter A Character :  a


a is a Vowel.


Enter A Character :  z


z is not a Vowel.

 

Leave a Reply

Your email address will not be published.