Check vowels by switch case in C by R4R Team

What is Vowel :
The alphabet {A,E,I,O,U} and {a,e,i,o,u} is known as vowels.
Other then this alphabet are known as consonant.

program-

#include< stdio.h>
int main() {
char s;
printf("Enter alphabet\n");
scanf("%c",&s);
switch(s)
{
case 'A':
printf("It is vowel");
break;
case 'E':
printf("It is vowel");
break;
case 'I':
printf("It is vowel");
break;
case 'O':
printf("It is vowel");
break;
case 'U':
printf("It is vowel");
break;
case 'a':
printf("It is vowel");
break;
case 'e':
printf("It is vowel");
break;
case 'i':
printf("It is vowel");
break;
case 'o':
printf("It is vowel");
break;
case 'u':
printf("It is vowel");
break;
default:
printf("It is consonant");
}
}


output-


Enter alphabet
A
It is vowel

Enter alphabet
i
It is vowel

Enter alphabet
f
It is consonant

-In this program, we take an input of any alphabet and check whether it is vowel or not.
- We just pass that variable in swicth statement, as shown in above program,
-if any case is true then it is vowel other default case will execute.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!