C program to check whether a character is an alphabet or not (Using Alphabets)

by | Jan 15, 2023 | C, C Programs


In this C program, we will explore how to check if a character is an alphabet or not.

The user is asked to enter a character value to check whether it is an alphabet or a non-alphabet character.

To understand this program, you should know about

1. C programming operators

2. C nested if…else statement

We have three ways to check whether a character is an alphabet or a non-alphabet.

In this program, we will use the alphabet to check the given condition.


int main()
char c;
printf("Enter a character:\n");

if((c>='a'&& c<='z') || (c>='A'&& c<='Z')) //all alphabets whether lower case or upper case lies in between these characters
printf("%c is an alphabet",c);
printf("%c is not an alphabet",c);
return 0;





The character value entered by the user is stored in variable ‘c’.

if((c>=’a’&& c<=’z’) || (c>=’A’&& c<=’Z’))

There are two conditions written in above if statement i.e., (c>=’a’&& c<=’z’) and (c>=’A’&& c<=’Z’). If either of them is true then the body of ‘if’ will be executed because they are operated with ‘||’ operator.

In the first output, the character is ‘v’ which lies in between ‘a to z’ thus, ‘v’ is an alphabet.

In the second output, the character is ‘&’ which neither lies in-between ‘a to z’ nor in-between ‘A to Z’. Thus, ‘&’ is not an alphabet.



Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.