Vowel or Consonant check  in C

Vowel or Consonant check in C

How can we check vowel or consonant in C? We use character variable to check this program and "printf" function to print the result.

Vowel or Consonant in C :


#include <stdio.h>

int main()
{
  char ch;
 
  printf("Enter a character : ");
  scanf("%c", &ch);

  if (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I' || ch =='o' || ch=='O' || ch == 'u' || ch == 'U')
    printf("%c is a vowel.\n", ch);
  else
    printf("%c isn't a vowel.\n", ch);
     
  return 0;
}
    

Output :