C program to check character is vowel or not

It’s the C program to check character is vowel or not. The user asked to enter a character,  then program check entered character is vowel or not, and print result on the screen.

To understand this program, it’s better you should know the following topics:

Program (1): to check the given character vowel or not.

#include<stdio.h>
#include<conio.h>
void main()
{
char c;
printf("Enter character: ");
scanf("%c",&c);
//logic to check vowels for  both Uppercase and Lowercase character
    switch(tolower(c))
    {
    case'a':
    case'e':
    case'i':
    case'o':
    case'u':
    printf("%c is a vowel.\n", c);
      break;
    default:
      printf("%c not a vowel.\n", c);
    }
getch();
}

Output (1)

Enter character: a
a is a vowel.

Published by

Electrical Workbook

We provide tutoring in Electrical Engineering.

Leave a Reply

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