C Program to check whether the Character is Alphabet or Not

In this tutorial, i am going to show you how to check whether the character is alphabet or not in c programs.

All C Programs to check whether the Character is Alphabet or Not

  • C Program to check whether the Character is Alphabet or Not using if else
  • C Program to check whether the Character is Alphabet or Not using isalpha Function

C Program to check whether the Character is Alphabet or Not using if else

#include <stdio.h>
int main()
{
  char ch;
  printf("\n Please Enter any character :- ");
  scanf("%c", &ch);
  
  if( (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') )
    printf("\n %c is an Alphabet", ch);
  else
    printf("\n %c is not an Alphabet", ch);
  
  return 0;
}

The result above c program; as follows:

Please Enter any character :- d
d is an Alphabet

C Program to check whether the Character is Alphabet or Not using isalpha Function

#include <stdio.h>
#include<ctype.h>
int main()
{
  char ch;
  
  printf("\n Please Enter any character :- ");
  scanf("%c", &ch);
  
  if( isalpha(ch) )
    printf("\n%c is an Alphabet", ch);
  else
    printf("\n %c is not an Alphabet", ch);
  
  return 0;
}

The result above c program; as follows:

Please Enter any character :- s
s is an Alphabet

More C Programming Tutorials

Leave a Comment