07/03/2016

C++ Program For Check Character Is Vowel Or Not Using If Else

Problem :- Write A C++ Program For Check Character Is Vowel Or Not Using If Else Statement .

Logic :- As we know that there are 26 Character in 
English Language and only 5 Vowel Or 21 Constant ,We also know that our keyboard support only two types of English Character Capital Of Small So only we need to compare with only 5 Character .
5 Vowels are A E I O U and rest are Constant . So just we need to compare with Capital and Small Both .
If you got the Logic then try to solve the given Problem  

Try Yourself C Program To Check Number Is Positive Or Negative

Solution :-

#include<bits/stdc++.h>
using namespace std;
int main()
{
  //Ghanendra Yadav
    char ch;
    
cout << "Enter an Alphabet :\n";
    cin >> ch;
    
    if(ch=='a'||ch=='A'||ch=='e'||ch=='E'||ch=='i'||ch=='I'||ch=='o'||ch=='O'||ch=='u'||ch=='U')
  {
        cout << ch << " Is A Vowel .\n";
    }
    else
  {
        cout << ch << " Is Not A Vowel.\n";
    }
   
    return 0;
}

Output:-

C++ Program For Check Character Is Vowel Or Not Using If Else

Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: