Check whether it is a vowel or consonant with C language
#include <stdio.h>
int main()
{
char character;
printf("Enter any character: ");
scanf("%c", &character);
/* Condition for vowel */
if (character == 'a' || character == 'e' || character == 'i' || character == 'o' || character == 'u' ||
character == 'A' || character == 'E' || character == 'I' || character == 'O' || character == 'U')
{
printf("'%c' is Vowel.", character);
}
else if ((character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z'))
{
printf("'%c' is Consonant.", character);
}
else
{
printf("'%c' is not an alphabet.", character);
}
return 0;
}
Output:-
Enter any character: a
'a' is Vowel.
0 Comments