Looking For Anything Specific?

ads header

C program to check whether an alphabet is vowel or consonant - Code With Manshi

From this example, we will check whether an alphabet is vowel or consonant.

To understand this program, you should have knowledge of these C programming Topics :
  • C programming Operators
  • if-else statement in C

Write a program for check whether a character is vowel or consonant in C?in C

 Program 
#include <stdio.h>
void main()
{
  char c;
  printf(Enter a character : ");
  scanf("%c", &c);
  if ((c>='a' && c<='z') || (c>='A' && c<='Z')) 
  {
    if (c=='a' || c=='A' || c=='e' || c=='E' || c=='i' || c=='I' || c=='o' || c=='O' || c== 'u' || c=='U')
    printf("%c is Vowel.\n", c);
    else
    printf("%c is Consonant.\n",c);
  }
  else
  printf("\n%c is Invalid Character.", c);
}

 Output 
Enter a character : a
a is Vowel


Post a Comment

0 Comments