Skip to content

Instantly share code, notes, and snippets.

@jagdish4501
Last active April 1, 2021 19:57
Show Gist options
  • Save jagdish4501/49120fc1046f80d526abe053fe1795ad to your computer and use it in GitHub Desktop.
Save jagdish4501/49120fc1046f80d526abe053fe1795ad to your computer and use it in GitHub Desktop.
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.
#include <stdio.h>
int main()
{
char ch;
int ASCII;
printf("enter a charcter :");
scanf("%c", &ch);
ASCII = ch;
if (ASCII >= 65 && ASCII <= 90)
{
printf("charcter is capital latter(A-Z)");
}
else if (ASCII >= 97 && ASCII <= 122)
{
printf("charcter is small latter(a-z)");
}
else if (ASCII >= 48 && ASCII <= 57)
{
printf("charcter is charecter(0-9)");
}
else if ((ASCII >= 0 && ASCII <= 47) || (ASCII >= 58 && ASCII <= 64) || (ASCII >= 91 && ASCII <= 97) || (ASCII >= 123 && ASCII <= 127))
{
printf("charcter is special symbol");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment