There are five vowel characters {a, e, i, o, u}. If the user given character input is one of them that means it is a vowel otherwise it is a consonant.
Logic
Here we have to manually check the given character with all the vowel characters, we cannot use ASCII value range to determine whether it is a vowel or a consonant. The given character can also be in the form of uppercase.
Program
#include <stdio.h> int main() { char c; printf("Enter a alphabet : "); scanf("%c", &c); // if given character is Lower case Vowel or Upper case Vowel // then print vowel otherwise consonant if ((c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') || (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')) { printf("\n%c is a vowel.", c); } else{ printf("\n%c is a consonant.", c); } return 0; }
Output
Enter a alphabet : A
A is a vowel.