C Program to Check Whether an Alphabet is Vowel or Consonant using Switch Case Statement

  • Write a C program to check whether a character is vowel or consonant using switch case statement.
  • How to find whether an alphabet is vowel or not using switch case statement.

Required Knowledge

A vowel is the alphabets that represents a speech sound created by the relatively free passage of breath through the larynx and oral cavity. Letters that are not vowels are consonants. English has five proper vowel letters (A, E, I, O, U) all alphabets except these characters are consonants.

C program to check whether a character is vowel or consonant using switch statement

#include <stdio.h>  
  
int main() {  
    char c;  
  
    /* 
     * Take a character as input form user 
     */  
    printf("Enter an Alphabet\n");  
    scanf("%c", &c);  
    
    /* Check If input alphabet is vowel or not 
    using switch statement */
    switch(c) {  
        case 'a':    
        case 'A':
        case 'e':  
        case 'E':
        case 'i':  
        case 'I':  
        case 'o':  
        case 'O':  
        case 'u':  
        case 'U': printf("%c is VOWEL", c);  
            break;  
        default: printf("%c is CONSONANT", c);  
    }  
  
    return 0;  
}
Output
Enter an Alphabet
e
e is VOWEL
Enter an Alphabet
Z
Z is CONSONANT

Related Topics
C program to find maximum of two numbers using switch statement
C program to check whether a number is odd or even using switch statement
C program to print name of days in week using switch statement
C program to check a number is odd or even using conditional operator
C program to check decimal digit character using conditional operator
C program to calculate area of a parallelogram
C program to make a simple calculator using switch statement
C program to convert temperature from celsius to fahrenheit
C program to reverse a number using recursion
List of all C programs