30: W.A.P. to check whether input alphabet is a vowel or not using switch case.

 

30: W.A.P. to check whether input alphabet is a vowel or not using switch case.

Program:

#include <stdio.h>

#include <conio.h>

 

void main()

{

   char ch;

   printf("\n\nEnter a Character = ");

   scanf("%c", &ch);

   switch (ch)

   {

   case 'a':

   case 'e':

   case 'i':

   case 'o':

   case 'u':

      printf("You have entered '%c' which is a vowel.", ch);

      break;

   default:

      printf("You have entered '%c' which is not a vowel.", ch);

      break;

   }

   getch();

}

 

Please follow me for more practicals....


Output:

Enter a Character = i

You have entered 'i' which is a vowel.

 

Please follow me for more practicals....


Algorithm:

1.      START.

2.      Declare ch.

3.      Enter the value of ch.

4.      If (ch == ‘a’ || ‘e’ || ‘i’ || ‘o’ || ‘u’) then goto step 5 else goto step 6.

5.      Display ch is a vowel.

6.      Display ch is not a vowel.

7.      STOP.


Please follow me for more practicals....


Flowchart:

Please follow me for more practicals....




Please follow me for more practicals....

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.