“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.
/* Write a C program to check whether a character is vowel or consonant alphabet */ #include<stdio.h> int main() { char ch; /* Input character at run time from user */ printf("Enter a character to check for Vowel or Consonant: "); scanf("%c", &ch); /* 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); else printf("%c is a Consonant"); } else printf("'%c' is not an Alphabet.", ch); return 0; }