Related Posts Plugin for WordPress, Blogger...

About

Follow Us

Monday 16 February 2015

Introduction
In this article I will explain how to check the character you entered is Vowel or Consonant using If-else Ladder in C.
A,E,I,O,U is known as Vowel and other alphabets are called Consonants.

#include<conio.h>
#include<stdio.h>
main()
{
       char ch;
      printf("Enter  any character between a to z : ");
      scanf("  %c",&ch);

                      if(ch=='a')
                            {
                            printf("%c  is vowel”,ch);
                            }
                      else if(ch=='e')
                            {
                            printf("%c  is vowel”,ch);
                            }
                      else if(ch=='i')
                            {
                            printf("%c  is vowel”,ch);
                            }
                      else if(ch=='o')
                            {
                            printf("%c  is vowel”,ch);
                            }
                        else if(ch=='u')
                            {
                            printf("%c  is vowel”,ch);
                            }                                
                    else
                           {
                            printf("%c  is consonant”,ch);
                           }
                    getch();
                    }
                   
 Run the program using Ctrl+F9
                   
Output:

First Run
 Enter any character between a to z : u
 u is vowel 
Second Run
 Enter any number between a to z : p

 p is consonant
Categories: ,

0 comments:

Post a Comment