C Program to check whether a character is vowel or consonant

In this tutorial you will learn about the C Program to check whether a character is vowel or consonant and its application with practical example.

In this tutorial, we will learn to create a C program that will check whether the entered alphabet by the user is a vowel or a consonant using C programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following C programming topics:

  • C Operators
  • Condition statement.
  • logical operator.

What Is Vowel and consonant?
Vowel :=> Sound that allowing breath to flow out of mouth, without closing any part of the mouth.
Consonant:=> Sound  made by blocking air from flowing out of the mouth with the teeth or throat.

Example

As we know A E I O U are called vowels. And renaming alphabets except these 5 vowels are called consonants.

Program to Check the given value is Vowel or consonant.

So here we creating a program in which we will find the given character is vowel or consonant.
As we know a,e,i,o,u are only vowel and rest are consonant.So simply we will check these and if given character belongs to them  then it is a vowel simple let’s have a look at program.

Output

Note: Here we assumes that the user will enter an alphabet. If not so then non-alphabetic character, it displays the character is neither a vowel nor a consonant.

In the above program, we have first declared a variables required in the program.

  • ch= hold given character.

First of all  user will be prompted to enter any character.Then with the help of program we will  check whether inputted character is a vowel or consonant,using following logic

As user inputs any character we check whether it’s a vowel both lower-case and upper-case are checked

If a character belong to this condition then it is vowel,and if   doesn’t meet it’s a consonant,and here we also check if it is not vowel and consonant it might be a digit or a special symbol.

So in this tutorial we have learn to find given character is vowel or consonant.

In this tutorial we have learn about the C Program to check whether a character is vowel or consonant and its application with practical example. I hope you will like this tutorial.