/* C program to check whether a given character is an alphabet,a digit,a space character or a special symbol */
void main()
{
char ch;
printf("Enter a character: ");
ch=getchar();
if(isalpha(ch))
{
printf("\n%c is an alphabet",ch);
if(isupper(ch))
printf("\n%c is in upper case",ch);
else
printf("\n%c is in lower case",ch);
}
else if(isdigit(ch))
printf("\n%c is a digit",ch);
else if(isspace(ch))
printf("\n%c is a space character",ch);
else if(ispunct(ch))
printf("\n%c is a punctuation",ch);
else
printf("\n%c is a special symbol",ch);
}
No comments:
Post a Comment