Home » C program to checks whether a character entered by the user is a vowel or not

C program to checks whether a character entered by the user is a vowel or not

Learn about C program to checks whether a character entered by the user is a vowel or not by using the switch case statement in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Contents

C program to checks whether a character entered by the user is a vowel or not

The below C program to checks whether a character entered by the user is a vowel or not by using the switch case statement.

Program:

#include<stdio.h>
int main()
{
   char ch;

   printf("Enter a 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("%c is vowel.", ch);
       break;
     default:
       printf("%c is not a vowel.", ch);
  }

  return 0;
}

Enter a character: e
e is vowel.

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C program using a switch case to check whether the number entered by the user is odd or even
Check Character is a lower, upper, digit or special character in C