Program to check entered alphabet is vowel or consonant in c language.
■》Program to check whether given alphabet is vowel or consonant in c language.
#include<conio.h>
void main()
{
char ch;
int lc ,uc;
printf("enter an alphabet=");
scanf("%c",&ch);
// check lower alphabet
lc=(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u');
// check upper alphabet
uc=(ch=='A'|| ch=='E' || ch=='I' || ch=='O'|| ch=='U');
if(lc || uc)
{
printf("entered alphabet is vowel.");
}
else
{
printf("entered alphabet is consonant");
}
getch();
}
■》 Output->
enter a alphabet=A
entered alphabet is vowel.
Comments
Post a Comment