C Program to Check whether an Alphabet is Vowel or Consonant

C Program to Check whether an Alphabet is Vowel or Consonant

This program takes the character value(entered by user) as input and checks whether that character is a vowel or consonant using if-else statement. Since a user is allowed to enter an alphabet in lowercase and uppercase, the program checks for both uppercase and lowercase vowels and consonants.

#include <stdio.h>
int main()
{
    char ch;
    bool isVowel = false;

    printf("Enter an alphabet: ");
    scanf("%c",&ch);

    if(ch=='a'||ch=='A'||ch=='e'||ch=='E'||ch=='i'||ch=='I'
    		||ch=='o'||ch=='O'||ch=='u'||ch=='U')
    {
    	isVowel = true;

    }
    if (isVowel == true)
        printf("%c is a Vowel", ch);
    else
        printf("%c is a Consonant", ch);
    return 0;
}

Output:

Enter an alphabet: E
E is a Vowel