WhatsApp us

Check vowel or consonant using switch case in C Programming

  • Tech Area
  • Last updated on: January 8, 2026



In this tutorial, We will see how to check vowel or consonant using switch case in C programming language. The switch expression is evaluated once. Switch statement allows us to execute one code block among many alternatives.

The syntax of the switch case is:

switch (expression)
​{
    case 1:
      // statements
      break;

    case 2:
      // statements
      break;
    .
    .
    default:
      // default statements
}

How does the switch statement work?

The expression is evaluated once and compared with the values of each case label i.e. case 1, case 2 and so on.

If there is a match, the corresponding statements after the matching label are executed. For example, if the value of the expression is equal to case 2, statements after case 2: are executed until break is encountered.

If there is no match, the default statements are executed.

Program to check vowel and consonant using Switch statement

#include<stdio.h>
#include<conio.h>
void main()
{
char z;
clrscr();
printf("Enter any character\n");
scanf("%c", &z);
switch(z)
{
case 'A':
case 'a':
printf("%c is a vowel", z);
break;

case 'E':
case 'e':
printf("%c is a vowel", z);
break;

case 'I':
case 'i':
printf("%c is a vowel", z);
break;

case 'O':
case 'o':
printf("%c is a vowel", z);
break;

case 'U':
case 'u':
printf("%c is a vowel", z);
break;

default:
printf("%c is a consonant", z);
}
getch();
}

Output

Enter any character
a
a is a vowel

The character a entered by the user is stored in the z variable. Since the z is a, the control of the program jumps to case 'a'.

case 'A':
case 'a':
printf("%c is a vowel", z);
break;

Finally, the break statement terminates the switch statement.


Subscribe us via Email

Join 20,000+ subscriber

Subscribe on YouTube

PHP Projects
Matrimonial Portal Project in PHP & MySQL Last Updated: December 22, 2025
Event Management System Project in PHP & MySQL Last Updated: December 6, 2025
Online Shopping System Project in PHP MySQL Last Updated: November 26, 2025
Hostel management system project in PHP and MySQL Last Updated: February 14, 2024
Online Pizza Delivery project in PHP Last Updated: February 4, 2024
Parking Management System project in PHP Last Updated: November 5, 2023
Visitors Management System project in PHP Last Updated: August 28, 2023
SNIPE – IT Asset management system v6.1.0 Last Updated: April 21, 2023
Employee Management System project in PHP Last Updated: January 21, 2023