Any character is entered through the keyboard; write a program to determine whether the character entered is a capital letter, a small case letter, digit or a special character. If You Use More Than 4 If-else Statements and More than One && Operator. In If Condition, your Number Will be Marked Zero. The following table shows the range of ASCII values for various characters.
Characters ASCII ValuesA – Z 65 – 90
a – z 97 – 122
0 – 9 48 – 57
Special symbols
0 - 47, 58 - 64, 91 - 96, 123 – 127
#include <stdio.h>
#include <conio.h>
void main()
{
char a;
int x=0;
printf("Enter any Character: ");
a=getch();
printf("%c\n",a);
x=(int)a;
if(x>=65 && x<=90)
printf("Entered Character is a Capital letter");
else if(x>=97 && x<=122)
printf("Entered Character is a Small letter");
else if(x>=48 && x<=57)
printf("Entered Character is a Digit");
else
printf("Entered Character is a Special Symbol");
getch();
}
{[['
']]}

0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.