Method-1
#include<stdio.h>
int main()
{
char ch;
printf("Enter the character\n");
scanf("%c",&ch);
switch(ch)
{
case'a':
printf("Enter character is vowel");
break;
case'e':
printf("Enter character is vowel");
break;
case'i':
printf("Enter character is vowel");
break;
case'o':
printf("Enter character is vowel");
break;
case'u':
printf("Enter character is vowel");
break;
case'A':
printf("Enter character is vowel");
break;
case'E':
printf("Enter character is vowel");
break;
case'I':
printf("Enter character is vowel");
break;
case'O':
printf("Enter character is vowel");
break;
case'U':
printf("Enter character is vowel");
break;
default:
printf("Enter character is not vowel");
}
}
Method-2
#include<stdio.h>
int main()
{
char ch;
printf("Enter the character\n");
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("Enter character is vowel");
break;
default:
printf("Enter character is not vowel");
}
}
OUTPUT
Enter the character
e
Enter character is vowel
Comments
Post a Comment