BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

C Program to Check whether an Alphabet is Vowel or Consonant

By Chaitanya Singh | Filed Under: C Programs

This program checks whether the input character is vowel or consonant.

Example: Program to check Vowel or Consonant

This program takes the character value(entered by user) as input and checks whether that character is a vowel or consonant using if-else statement. Since a user is allowed to enter an alphabet in lowercase and uppercase, the program checks for both uppercase and lowercase vowels and consonants. To understand this program, you should be familiar with the following C Programming concepts:

  1. C Programming if statement
  2. C Programming if..else statement
#include <stdio.h>
int main()
{
    char ch;
    bool isVowel = false;

    printf("Enter an alphabet: ");
    scanf("%c",&ch);

    if(ch=='a'||ch=='A'||ch=='e'||ch=='E'||ch=='i'||ch=='I'
    		||ch=='o'||ch=='O'||ch=='u'||ch=='U')
    {
    	isVowel = true;

    }
    if (isVowel == true)
        printf("%c is a Vowel", ch);
    else
        printf("%c is a Consonant", ch);
    return 0;
}

Output:

Enter an alphabet: E
E is a Vowel

Check out these related C Programs:

  1. C Program to convert lowercase string to uppercase
  2. C Program to convert uppercase string to lowercase
  3. C Program to find ASCII value of a character
  4. C Program to concatenate two strings without using pre-defined function
  5. C Program to find length of a string without using strlen

Top Related Articles:

  1. C Program to check whether a Character is an Alphabet or not
  2. C Programming examples with Output
  3. C++ Program to Convert Uppercase to Lowercase
  4. Python Program to Check Vowel or Consonant
  5. Java Program to check Vowel or Consonant using Switch Case

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Programs

  • C Programs
  • Java Programs
  • C++ Programs

Copyright © 2012 – 2023 BeginnersBook . Privacy Policy . Sitemap