Pages

Monday

C Program to Check the Given Character is Vowel or not

Here's a C program to check whether the given character is vowel or not with example and explanation. This program uses an IF-ELSE Condition to determine whether the given character is a vowel or not.


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


Output of above program

Enter the character : a
a is a vowel


Enter the character : z
z is not a vowel


Explanation of above program

This program first asks the user to enter a character and stores its value in character variable c. Then using an IF-Else condition, program checks whether the entered character is among {a, e, i, o, u, A, E, I, O, U}. If entered character is among this set, program prints that entered character is vowel otherwise, program prints that entered character is not a vowel.

1 comment:

  1. Greetings Mate,


    Brilliant article, glad I slogged through the it seems that a whole lot of the details really come back to from my past project.

    why is saying c programming is a based on java?

    Very useful article, if I run into challenges along the way, I will share them here.


    Obrigado,

    ReplyDelete