C++ program to check whether a character is alphabet or not

Checking whether a Character is Alphabet or Not?

In c++ programming language a char type variable can store many different types of characters-
  • Alphabets (a, b, c… )
  • Digits(1, 2, 3…)
  • Special characters(@, %, &…)
These characters are differentiated on the basis of ASCII values :
  • between 65 and 90 for upper case(A, B, C…)
  • between 97 and 122 for lower case(a, b, c…)
In here we will see how to identify whether a character is alphabet or not using C++ programming language.
C++ program to check whether a character is alphabet or not


  • User gives an input.
  • The user input is stored in a char type variable lets say alpha.
  • The  alpha is then checked if it lies between the specified character ASCII range of alphabets i.e. 67-90 and 97-122.
  • If alpha lies between the specifies range then alpha is a alphabet.
  • If alpha does not lie between the specified range then it is Not  Alphabet.

C++ Code:-

//Character is Alphabet or not
using namespace std;

//main program
int main()

char alpha;
cout<<"Enter a character: "; 

//checking for alphabet using ASCII value
if((alpha>=65 && alpha<=90)||(alpha>=97 && alpha<=122))

//input lies in range
cout<<alpha<<" is an alphabet ";

//input does not lie in range 
cout<<alpha<<" is not an alphabet ";
return 0;
Enter a character: A
A is an alphabet