PROGRAM
//Program to check whether given character is vowel or consonant
#include <iostream>
using namespace std;
int main()
{
char ch;
cout<<"ENTER CHARACTER : ";
cin>>ch;
// Checking for Upper Case Vowel
if(ch>=65 && ch<=90)
{
if(ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U')
{
cout<<ch<<" IS A VOWEL";
}
else
{
cout<<ch<<" IS A CONSONANT";
}
}
// Checking for Lower Case Vowel
else if(ch>=97 && ch<=122)
{
if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u' )
{
cout<<ch<<" IS A VOWEL";
}
else
{
cout<<ch<<" IS A CONSONANT";
}
}
else
{
cout<<"\nPLEASE ENTER A CHARACTER! ";
}
return 0;
}
OUTPUT
//Program to check whether given character is vowel or consonant
#include <iostream>
using namespace std;
int main()
{
char ch;
cout<<"ENTER CHARACTER : ";
cin>>ch;
// Checking for Upper Case Vowel
if(ch>=65 && ch<=90)
{
if(ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U')
{
cout<<ch<<" IS A VOWEL";
}
else
{
cout<<ch<<" IS A CONSONANT";
}
}
// Checking for Lower Case Vowel
else if(ch>=97 && ch<=122)
{
if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u' )
{
cout<<ch<<" IS A VOWEL";
}
else
{
cout<<ch<<" IS A CONSONANT";
}
}
else
{
cout<<"\nPLEASE ENTER A CHARACTER! ";
}
return 0;
}