Program to check whether the input alphabet is vowel or not by using if else and switch statements.

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

 

About Programmingfaster

We the teams of programming faster managed to provide an effective information about the codes of different programming languages.Hope you will learn and understand the codes fast and easy. It's absolutely free, expanding and precise. Our main target is to help those new starters and aid them as far as possible to pave their future in the area of programming. Hoping support and recommendations!
This entry was posted in C, precise examples and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *