CPP
#include<iostream>
Try it Yourself ➠
Output :-
Character is Alphabet or Not in C++
16 May
0
Write a program (WAP) in C++ to read two numbers from keyboard(User Input) to know a character is Alphabet or Not.
#include<iostream>
using namespace std;
int main()
{
char ch;
cout<<"Enter a character: ";
cin>>ch;
if((ch>='A'&& ch<='Z') || (ch>='a' && ch<='z'))
{
cout<<ch<<" is an ALPHABET\n";
}
else
{
cout<<ch<<" is not an ALPHABET\n";
}
return 0;
}
Try it Yourself ➠
Output :-
When the above C++ program is compile and executed, it will produce the following result,
i. Alphabet - Uppercase
ii. Alphabet - Lowercase
iii. Not alphabet - Number
iv. Not alphabet - Special Character
Must Read :-
Previous article
Next article
Leave Comments
Post a Comment