Wednesday, July 29, 2020

Write a Program to Check Whether a character is Vowel or Consonan in C++.

Vowel or Consonan in C++.


#include <iostream>
using namespace std;
int main()
{
char ch;
int Low, Upp;
cout << "Enter an alphabet: ";
cin >> ch;
Low = (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
Upp = (ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U');
if (Low || Upp)
cout << ch << " is a vowel.";
else
cout << ch << " is a consonant.";
return 0;
}



OUTPUT

Enter an alphabet: A
A is a vowel.

No comments:

Post a Comment

Please do not any spam link in Comment Box