ProAnswers.org

Write a C program to accept a character and determine whether it is an alphabet, character or special symbol

Write a program to accept a character and determine whether it is an alphabet, character or special symbol

#include /header file/
void main() /main function/
{
char ch; /variable declaration/
printf("
Enter a character : “);
scanf(”%c",& ch);
if(ch>=65 && ch<=90)
{
printf("
The character is an upper case letter");
}
if(ch>=97 && ch<=122)
{
printf("
The character is an lower case letter");
}
if(ch>=48 && ch<=57)
{
printf("
The character is a digit");
}
if(ch>=0 && ch<48)||(ch>=57 && ch<65)
||(ch>90 && ch<97)||(ch>122)
{
printf("
The character is a special symbol");
}
}