C Program to Check Vowel or Consonant

How to write a C Program to Check Vowel or Consonant with an example?. In English, five alphabets A, E, I, O, and U called Vowels. All the remaining alphabets except these five called consonants.

A user will input a character and we will check whether it is a vowel or not. Both lower-case and upper-case are checked. The five letters A, E, I, O and U are called vowels. All other alphabets except these 5 vowels are called consonants. This program assumes that the user will always enter an alphabet character.

Example Using If Else

Output:

Explanation Of Code

The character entered by the user is stored in variable c.

The lowercase variable evaluates to 1 (true) if c is a lowercase vowel and 0 (false) for any other characters. Similarly, the uppercase variable evaluates to 1 (true) if c is an uppercase vowel and 0 (false) for any other character.

If either lowercase or uppercase variable is 1 (true), the entered character is a vowel. However, if both lowercase and uppercase variables are 0, the entered character is a consonant.

Example Using Switch Case

Assuming character is accepted as an input.

Output:

Top Book Suggestion

The two books on C Programming Language that I Personally Recommend. I really loved reading these books. These books are listed for quality content, easy steps, and affordable price. You can get it from Amazon and Flipkart. 

 

Check The Price On Amazon:

1. C Programming Beginner’s Guide

2. Head First C: A Brain-Friendly Guide

Check The Price On Flipkart:

1. Introduction to C Programming 

2. Head First C: A Brain-Friendly Guide

Buy Premium Courses At Lowest Price. Become A Certified Developer Today!

Important C Programs

Pin It on Pinterest

Share This