Table of Contents
Program to Check Vowel or Consonant in C
Five English alphabet letter a , e, i, o and u are known as vowels. All other alphabets are consonant.
In this tutorial we will learn to implement a program in c to check whether a Character is a Vowel or Consonant using switch case.
This program is generally asked in C Programming Subject of various university examination. This is an important program for fresher.
#include <stdio.h>
#include<conio.h>
void main( )
{
char ch1;
/* Take Input an alphabet from user */
printf(“Enter any alphabet: “);
scanf(“%c”, &ch1);
/* Switch value of ch1 */
switch(ch1)
{
case ‘a’:
printf(“Vowel”);
break;
case ‘e’:
printf(“Vowel”);
break;
case ‘i’:
printf(“Vowel”);
break;
case ‘o’:
printf(“Vowel”);
break;
case ‘u’:
printf(“Vowel”);
break;
case ‘A’:
printf(“Vowel”);
break;
case ‘E’:
printf(“Vowel”);
break;
case ‘I’:
printf(“Vowel”);
break;
case ‘O’:
printf(“Vowel”);
break;
case ‘U’:
printf(“Vowel”);
break;
default:
printf(“Consonant”);
}
getch();
}
Output