C program to check the given character is alphabet or digit or special character

In this post we will know about C program to check the given character is alphabet or digit or special character and the code for it.

Code for C program to check the given character is alphabet or digit or special character

#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

Enter any character: D
D is alphabet.
Enter any character:6
6 is digit.
Enter any character: &
& is Special Character.

Read: C program to find the multiplication of two numbers in table format


If You Like This Page Then Make Sure To Follow Us on Facebook, G News and Subscribe Our YouTube Channel. We will provide you updates daily.
Shares
facebook sharing button Share
twitter sharing button Tweet
whatsapp sharing button Share
telegram sharing button Share
pinterest sharing button Pin

Leave a Comment