Tuesday, 28 October 2014

Input a character and check it whether it is vowel or not using switch case



Input a character and check it whether it is vowel or not using switch case




/*WAP to input a character and check it whether it is vowel or not using switch case*/

#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
clrscr();
printf("enter the 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);
}
getch();
}

OUTPUT:
enter the character:r

r is not a vowel

No comments:

Post a Comment