Write a program to identify whether the given character is an alphabet, digit, whitespace or punctuation using simple if
#include < stdio.h>
int main()
{
char ch;
/* Input character from user */
printf("Enter any character: ");
scanf("%c", &ch);
/* Alphabet check */
if (isalpha(ch))
{
printf("'%c' is alphabet.", ch);
}
else if(isdigit(ch))
{
printf("'%c' is digit.", ch);
}
else if(ispunct(ch))
{
printf("'%c' is punctuation.", ch);
}
elseif(isspace(ch))
{
printf("This is a whitespace”);
}
else
{
printf("'Invalid Character”);
}
return 0;
}