Problem Analysis:
The problem is to check whether the input alphabets is vowel or not by using if else and switch statements.
Algorithm 1: (using if else)
1.start
2.define :ch
3.Input; ch from the user.
4. If (ch==’a’//ch==’e’//ch==’i’//ch==’o’//ch==’u’
//ch==’A’//ch==’E’//ch==’I’//ch==’O’//ch==’U’)
print the vowel else nothing.
5. Output:vowel.
6.End
Algorithm 2: (using switch)
1.start
2.Define :ch
3.Input ch from the user.
4.Switch (ch);
case ‘a’:, case’e’:, case’i’:,case’o’:
,case’u’:,case’A’:.case’E’:,case’I’:,case’O’:,case’U’:
print as vowel else default as nothing.
5.output the vowel.
6.End
Codes 1;
Outputs:
Compiling , Debuggings and Testings.
Enter character : a a is a vowel.
Codes 2:( using switch)
#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
printf(“enter 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(“vowel \”);
break;
{
default:
printf(“not vowel’);
getch():
}
Outputs:
Compiling , Debugging and Testings.
Enter character : a
a is vowel