Algorithm to Check whether Input character is a Vowel or Consonant

[51006 views]


There are 26 alphabets in our English language. Out of which, 21 are consonants and five are vowels. The five vowels are A,E,I,O,U.

In this article, we will write an algorithm to find whether an input character is Vowel or Not.

Flowchart to check whether a character is vowel or consonant

Flowchart to check whether a character is vowel or consonant

Algorithm to check whether a character is vowel or consonant

Step 1: Start Step 2: Declare character type variable ch Step 3: Read ch from User Step 4: // Checking both lower and upper case vowels. IF (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I' || ch == 'o' || ch == 'O' || ch == 'u' || ch == 'U' ) Print "Vowel" ELSE Print "Consonant" Step 5: Stop

In the above algorithm,
1. We first declare a variable ch of character datatype.
2. Then we read one character from the user and store it in a variable "ch"
3. Then we compare "ch" with the vowels in both upper and lower case. If it matches we print "vowel" else we print "Consonant".

        


Comments

5 comment
  • Rohit Chettri

    Thank you so much for uploading this.

  • Mon Isham

    Very Easy

  • Honey

    Nice

  • kajoy

    What if the user inout a special character?

  • Aayushi singh

    Thank you so much to help me.



Search
New Year Deals End in










Recommended Quiz
Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online

Search Tags

    Find Whether character is Vowel or Not

    Pseudocode to check if input character is Vowel or Consonant