Saturday, January 30, 2010

CHAP 2[F]b Detecting capital,small letter ,digit or symbol

Any character is entered through the keyboard, write a program to determine whether the character entered is a capital letter, a small case letter, a digit or a special symbol.
The following table shows the range of ASCII values for various characters.










void main()
{
char a;
printf("\nEnter any character\n");
scanf("%c",&a);

if(a>=65&&a<=90)
printf("\nThe character is a capital letter");

else if(a>=97&&a<=122)
printf("\nThe character is a small case letter");

else if(a>=48&&a<=57)
printf("\nThe character is a number");

else
printf("\nThe character is a special symbol");
}

No comments:

Post a Comment