C Program to Check an Element is Digit or Alphabet or a Special Character.

Below is a simple C program that checks whether an input character is a digit, alphabet, or a special character.

Program :

#include<stdio.h>
#include<conio.h>
int main()
{
char ch;
printf(“Enter any character: “);
scanf(“%c”,&ch);

if((ch>=’a’&&ch<=’z’)||(ch>=’A’&&ch<=’Z’))
{
printf(“‘%c’ is alphabet.”,ch);
}
else if(ch>=’0’&&ch<=’9′)
{
printf(“‘%c’ is digit.”,ch);
}
else
{
printf(“‘%c’ is special character.”,ch);
}

return 0;
}

Output :

Leave a Comment

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

Shopping Basket
Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare
Verified by MonsterInsights