C program to check whether a given alphabet is a vowel or consonant

In this post we will give you code for c program to check whether a given alphabet is a vowel or consonant.

C program to check whether a given alphabet is a vowel or consonant

#include<stdio.h>
#include<conio.h>
int main()
{
 char c;
 int lv,uv;
 printf("Enter an alphabet: ");
 scanf("%c", &c);
 lv = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
 uv = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');
 if (lv || uv)
 printf("%c is a vowel.", c);
 else
 printf("%c is a consonant.", c);
 return 0;
}

Output:

Enter an alphabet: A
A is a vowel.
Enter an alphabet: D
D is a consonant.

Read: C program to check the given character is alphabet or digit or special character


If You Like This Page Then Make Sure To Follow Us on Facebook, G News and Subscribe Our YouTube Channel. We will provide you updates daily.
Shares
facebook sharing button Share
twitter sharing button Tweet
whatsapp sharing button Share
telegram sharing button Share
pinterest sharing button Pin

Leave a Comment