C program to check vowel or consonant using ASCII value and conditional operator
C program to check vowel or consonant using ASCII value and conditional operator
#include <stdio.h>
int main()
{
char ch;
printf("Enter any character: ");
scanf("%c", &ch);
(ch==97 || ch==101 || ch==105 || ch==111 || ch==117 ||
ch==65 || ch==69 || ch==73 || ch==79 || ch==85)?
printf("\n %c It is vowel",ch):
((ch >= 97 && ch <= 122) || (ch >= 65 && ch <= 90))?
printf("\n %c It is consonant",ch):
printf("\n %c It is NOT ALPHABET",ch);
return 0;
}
Output:
Enter any character: o
o It is vowel
Enter any character: p
p It is consonant
Enter any character: 8
8 It is not alphabet