Latest :

C Program To Check If Vowel Or Consonant | 4 Simple Ways

C Program to input an alphabet and check for a vowel or consonant – In this particular article, we will brief in on how to input an alphabet and check for a vowel or a consonant.

Suitable examples and sample programs have also been added so that you can understand the whole thing very clearly. The compiler has also been added with which you can execute it yourself.

There has been only one method mentioned in this specific piece to check for a vowel or a consonant.

C Program To Check Whether It Is Vowel Or Consonant

As given in the photo above, the vowels in the English language are:

  • A
  • E
  • I
  • O
  • U

The other 21 alphabets are considered as Consonants. Thus, the way to check for a vowel or a consonant in C programming is as follows:

C program to input any alphabet and check whether it is vowel or consonant

1)Read the entered character and check is it a character or not using if condition. If ASCII value is between 65 to 90 or 97 to 122 so entered character is an alphabet.

2)Compare the alphabet with each vowel a, e, i, o, u using if condition, if it matches with any one of the vowels then it prints “character is vowel”, otherwise it prints “character is consonant”.

3)If the entered character ASCII value is not in the range between 65 to 90 or 97 to 122 then it prints “character is not an alphabet”.

Output:
x

Check Also

C Program To Check A Number Is Negative, Positive Or Zero | C Programs

C program to check whether a number is negative, positive or zero – In this ...