C Program to Check Whether a Character is Vowel or not
Program
#include<stdio.h>
#include<conio.h>
int main()
{
char ch;
clrscr();
printf("Enter any character: ");
scanf("%c", &ch);
/* Converting to lowercase if it is uppercase. */
ch = ch>='A'&&ch<='Z'?ch+32:ch;
/* Making Decision */
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
{
printf("It is VOWEL.");
}
else
{
printf("It is NOT VOWEL.");
}
getch();
return(0);
}
Output of above program :
Run 1: ---------- Enter any character: a ↲ a is VOWEL. Run 2: ---------- Enter any character: I ↲ I is VOWEL. Run 3: ---------- Enter any character: B ↲ B is NOT VOWEL. Run 4: ---------- Enter any character: 9 ↲ 9 is NOT VOWEL. Note: ↲ indicates ENTER is pressed.