C Program to Check Whether a Character is Vowel or not using switch statement


</code>: check vowels

/* C Program to Check Whether a Character is Vowel or not using switch statement */

#include <stdio.h>
 
int main()
{
  char s;
  // get input from user
  printf("Enter any character :");
  scanf("%c", &s);
 
  switch(s)
  {
    case 'a':
  printf("%c is a vowel.\n", s);
        break;
    case 'A':
  printf("%c is a vowel.\n", s);
        break;
    case 'e':
  printf("%c is a vowel.\n", s);
        break;
    case 'E':
  printf("%c is a vowel.\n", s);
        break;
    case 'i':
  printf("%c is a vowel.\n", s);
        break;
    case 'I':
  printf("%c is a vowel.\n", s);
        break;
    case 'o':
  printf("%c is a vowel.\n", s);
        break;
    case 'O':
  printf("%c is a vowel.\n", s);
        break;
    case 'u':
  printf("%c is a vowel.\n", s);
        break;
    case 'U':
        printf("%c is a vowel.\n", s);
        break;
    /* if above not match any character then 
    default this section is execute  */
 default:  
        printf("%c is not a vowel.\n", s);
  }              
 
  return 0;
}

output

Enter any character :E
E is a vowel.

LANGUAGE