C Language program take a character and tell its vowel or consonant


Following program shows you how to take a character and tells its vowel or consonant.
In this program we get a character from user and shows it's vowel or consonant using if condition

#include <stdio.h>

int main(void) {
	char input;
	printf("Please enter a character:");
	scanf("%c", &input);
	if (input == 'a' || input == 'A' || input == 'e' || input == 'E' ||
		input == 'i' || input == 'I' || input == 'o' || input == 'O' ||
		input == 'u' || input == 'U') {
		printf("Its a vowel");
	} else if (
		(input >= 'a' && input <= 'z') || (input >= 'A' && input <= 'Z')) {
		printf("Its a consonant");
	} else {
		printf("Its not an alphabet");
	}
}

Output:

Example1:

Please enter a character: i
Its a vowel 

Example2:

Please enter a character: w
Its a consonant 

Example3:

Please enter a character: 0
Its not an alphabet