Else if ladder or multiple else if to check character is vowel or consonant in C language

Introduction: In previous article i explained Else if ladder or multiple else if to check the day corresponding to number in C Language and Else if ladder or multiple else if to check the month of entered number in C language. In this article i will explain how to check whether entered character is Vowel or  Consonant using ladder else if or we can say multiple else if in C Language. Vowels are a,e,i,o,u and all other alphabets other than the Vowels are 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

Previous
Next Post »

If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..