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.
#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();
}
Enter a character: A
'A' is a Vowel.
Enter a character: w
'w' is a Consonant.