C program to check whether a character is a vowel or consonant


  1. Input a character
  2. Check whether it is a vowel or not for Both lower-case and upper-case are checked.(Vowels are A,E,I,O,U,a,e,I,o,u and other alphabets are consanants)
					#include <stdio.h> 
void main() 
char ch; 
printf("Enter a character\n");
scanf("%c", &ch);
// Checking both lower and upper case characters, || is the OR operator 
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); 
printf("%c is not a vowel.\n", ch);   

Leave a Reply