Check Vowel in C


Q. Write a C program to check a character is vowel or not.

#include <stdio.h>
#include <conio.h>
 
void main()
{
    char ch;
    clrscr();
    printf("Enter a character: ");
    scanf("%c", &ch);
    if (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I' 
    || ch =='o' || ch=='O' || ch == 'u' || ch == 'U')
    {
        printf("%c is a vowel.", ch);
    }
    else
    {
        printf("%c isn't a vowel.", ch);
    }
    getch();
}

Q. Write an algorithm to check a character is vowel or not.

 Step 1: Start

Step 2: Declare a character variable `ch`

Step 3: Prompt the user to enter a character

Step 4: Read the input character and store it in `ch`

Step 5: Check if the character `ch` is one of the vowels:

- If `ch` is `'a'` or `'A'` or `'e'` or `'E'` or `'i'` or `'I'` or `'o'` or `'O'` or `'u'` or `'U'`

Then

- Print "`ch` is a vowel."

- Else

- Print "`ch` isn't a vowel."

Step 6: End



OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.