Friday, 3 August 2018

Algorithm to check Input Character Check is Vowel or Consonant in C


Program To Input a Character From User And Check Enter Character Is Vowel or Consonant

/*program character is c or v*/
#include <stdio.h>
void main ()
{
char ch ;
clrscr () ;
printf ("/n Enter a character:") ;
scanf ("%c", & ch) ;
switch (ch)
{
case 'a';
printf ("/n vowel:") ;
break ;
case 'e';
printf ("/n vowel:") ;
break ;
case 'i';
printf ("/n vowel:") ;
break ;
case 'o';
printf ("/n vowel:") ;
break ;
case 'u';
printf ("/n vowel:") ;
break ;
default :
printf ("/n character is consonant:") ;
}
getch () ;
}

Output :: Enter a character :  a

                   Character is vowel
                 
                   Enter a character :   z
     
                  character is consonant 

ALGORITHM :: 

                                CHECK INPUT CHARACTER IS VOWEL OR CONSONANT

This is a program of having to check input character is vowel or consonant .

STEP 1. START.
STEP 2. INPUT A CHARACTER.
STEP 3. [ CHECK VOWEL OR CONSONANT ]
                1. IF ENTER CHARACTER IS A , E , I . O , U ]
                2. PRINT CHARACTER IS VOWEL.
                3. OTHERWISE.
                4. PRINT CHARACTER IS CONSONANT.
             [ STEP LOOP 3 IS END ]
STEP 4. STOP.

No comments:

Post a Comment

Featured post

Program to find maximum of three number using user define function in C++

A function can be define by the user as per the requirement of the user or programmer . To implement a user define function , a programmer ...