C Program to check whether input alphabet is consonat or not
Here is simple C program to check a input alphabet is consonant or not. a,e,i,o,u,A,E,I,O and U are vowel, except these alphabets, all alphabets are consonant.
#include<stdio.h> int main() { char ch; printf("Enter a alphabet: "); scanf("%c",&ch); if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u') { printf("Alphabet is not consonant \n"); } else if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U') { printf("Alphabet is not consonant \n"); } else { printf("Alphabet is consonant \n"); } return 0; }Another C program using switch loop
#include<stdio.h> int main() { char ch; printf("Enter a alphabet: "); scanf("%c",&ch); switch(ch) { case 'a': case 'e': case 'i': case 'o': case 'u': case 'A': case 'E': case 'I': case 'O': case 'U': printf("Alphabet is not consonant \n"); break; default: printf("Alphabet is consonant \n"); } return 0; }