Program to accept a character and check whether entered character is vowel or not using switch statement

This program accepts a character and check whether entered character is vowel or not using switch statement.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "conio.h"
#include "stdio.h"
 
void main()
{
  char ch;
  printf("\nEnter a charecter to check ");
  scanf("%c",&ch);
  switch(ch)
  {
  case 'a':
	 printf("\nThe entered charecter %c is a vowel",ch);
	 break;
  case 'e':
	 printf("\nThe entered charecter %c is a vowel",ch);
	 break;
  case 'i':
	 printf("\nThe entered charecter %c is a vowel",ch);
	 break;
  case 'o':
	 printf("\nThe entered charecter %c is a vowel",ch);
	 break;
  case 'u':
	 printf("\nThe entered charecter %c is a vowel",ch);
	 break;
  default:
	 printf("\nThe entered is a consonant");
  }
getch();
}

Output:

Enter a charecter to check i
The entered charecter i is a vowel
Chitra
Chitra

One thought on “Program to accept a character and check whether entered character is vowel or not using switch statement

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in