Skip to content
Home » C Program to Check Character is an Alphabet or not

C Program to Check Character is an Alphabet or not

Learn about C Program to Check Character is an Alphabet or not in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Check Character is an Alphabet or not using if else program in C

The program takes a character as a input from the user. Then using the ASCII value of the character it checks whether it is a Alphabet or not.

Program:

 #include<stdio.h>
 int main()
 {
      char ch;

      printf("Enter any character: ");
      scanf("%c",&ch);

      if ((ch>=65 && ch=97 && ch<=122))
      {
        printf("%c is an alphabet.\n",ch);
        printf("ASCII value of %c is %d\n",ch,ch);
      }
      else printf("%c is not an alphabet.",ch);

      return 0;
 }

Output:

Enter a character: d
d is a lowercase alphabet.

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
Check Character is a Lowercase Alphabet or Not using If Else Program in C
Check Character is an Uppercase Alphabet or not using If Else Program in C