To find a user input character is vowel or not {using switch case:}
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("enter character = ");
scanf("%c",&n);
switch (n)
{
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':
printf("it is vowel ");
break;
default :
printf("it is not a vowel");
}
getch();
}
OUTPUT :
enter character =a
it is vowel
enter character = l
it is not a vowel
Comments
Post a Comment