“Check Vowel or Consonant Character” is a C program to input a character and check whether it is vowel or consonant.
This C program uses nested if else statement for condition checking.
C Program Vowel or Consonant Checker program
Write a C program to check whether
a character is vowel or consonant alphabet
/* Input character at run time from user */
printf("Enter a character to check for Vowel or Consonant: ");
/* check if character is alphabet a to z or A to Z */
if( (ch>='a' && ch<='z') || (ch>='A' && ch<='Z') )
/* check if character is vowel AIOU or aiou */
if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u' ||
ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U')
printf("'%c' is Vowel.", ch);
printf("%c is a Consonant");
printf("'%c' is not an Alphabet.", ch);
2,969 total views, 1 views today