A Program to Check a Character is Alphabet or Not
In this example, we are giving a program to check a given character is alphabet or not.
Program to check a character is alphabet or not:
#include <iostream>
using namespace std;
int main()
{
char c;
cout << "Enter a character: ";
cin >> c;
if( (c>='a' && c<='z') || (c>='A' && c<='Z'))
cout << c << " is an alphabet.";
else
cout << c << "is not an alphabet.";
return 0;
}
Output:
Enter a character: F F is an alphabet