C Program to Check Vowel or Consonant Using Switch Case

C Program to check vowel or consonant using switch case for beginners to execute c program to check vowel or consonant.

Switch Statement in C

A switch statement allows a variable to be compared to a list of values for equality. Each value is referred to as a case, and each switch case is compared to the variable that is being turned on. 

A switch statement is a type of selection control mechanism used in computer programming languages to allow the value of a variable or expression to change the control flow of program execution via search and map.

Break Statement in C

In C, the break keyword is used to remove the program control from the loop. Inside loops or switch statements, the break statement is used. 

The break statement breaks each loop one at a time, so in nested loops, the inner loop is broken first, followed by the outer loops. 

In C programming, there are two uses for the break statement: 

When a break statement is encountered within a loop, the loop is immediately terminated, and program control is resumed at the next statement after the loop. In the switch statement, it can be used to end a case.

#include <stdio.h>
int main()
{
char ch;
printf("Enter The Letter");
scanf("%c", &ch);
switch(ch)
{
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");
}
return 0;
}

Output:

Enter The Letter g
Consonant