24. WRITE A C PROGRAM TO CHECK VOWEL OR CONSONANT USING SWITCH CASE

/*C program to check vowel or consonant using switch case*/


#include <stdio.h>
int main()
{
char ch;
/*
* Reads an alphabet from user
*/
printf("Enter any character: ");
scanf("%c", &ch);

switch(ch)
{
case 'a': 
case 'e': 
case 'i':
case 'o':
case 'u':
case 'A':
case 'E':
case 'I':
case 'O':
case 'U': printf("VOWEL");
break;
default: printf("CONSONANT");
}

return 0;
}

output

Enter any alphabet: E
VOWEL

Comments