C Program to Check Whether a Character is Vowel or Consonant

In this program, you will learn to check a character entered by user is Vowel or consonant. The five letters A, E, I, O, U are called Vowels. All other characters are called as consonant.



Source Code
#include <stdio.h>
#include<conio.h>
void main()
{
    char ch;
    //clsrscr();
    printf("Enter a character: ");
    scanf("%c", &ch);
    if (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I' || ch =='o' || ch=='O' || ch == 'u' || ch == 'U')
    {
        printf("'%c' is a Vowel.\n", ch);
    }
    else
    {
        printf("'%c' is a Consonant.\n", ch);
    }
    getch();
}
Output
Enter a character: A
'A' is a Vowel.

Enter a character: w
'w' is a Consonant.





"Coding Hub - Learn to code" app now available on Google Play Store