Algorithm to Check whether Input character is a Vowel or Consonant

(2358 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 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".

Solution Worked 5 UpvotesUpvote

        

Solution Didn't Worked 2 DownvotesDownvote



Comments

1 comment
  • Rohit Chettri

    Thank you so much for uploading this.



Search
Play 2048 Game Online

Search Tags

    Find Whether character is Vowel or Not

    Pseudocode to check if input character is Vowel or Consonant