Check value it is the alphabet, digit or special character with C language
#include <stdio.h>
int main()
{
char value;
printf("Enter any character: ");
scanf("%c", &value);
/* Alphabet check */
if ((value >= 'a' && value <= 'z') || (value >= 'A' && value <= 'Z'))
{
printf("'%c' is alphabet.", value);
}
else if (value >= '0' && value <= '9')
{
printf("'%c' is digit.", value);
}
else
{
printf("'%c' is special character.", value);
}
return 0;
}
Output:-
Enter any character: 6
'6' is digit.
0 Comments