Monday, 24 July 2017

write a program to determine whether the character entered is a capital letter, a small case letter , etc

Write a program to determine whether the character entered is a capital letter, a small case letter , etc .

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.

Characters
ASCII values
A-Z
65-90
a-z
97-122
0-9
48-57
Special symbols
0-47, 58-64, 91-96, 123-127


Code:

#include<stdio.h>
#include<conio.h>
void main()
{
char c;
printf("Enter A Charachter: ");
scanf("%c",&c);
if(c>=65&&c<=90)
{
printf("\nUpper Case Letter");
}
else if(c>=97&&c<=122)
{
printf("\nLower Case Letter");
}
else if(c>=48&&c<=57)
{
printf("\nDigit");
}
else if(((c>=0&&c<=47))||((c>=58&&c<=64))||((c>=91&&c<=96))||((c>=123&&c<=126)))
{
printf("\nSpecial Symbol");
}
getch();
clrscr();
}

Output:


Try it yourself.
If you have any problem you can tell me on comment box i will help you.
thanks.

Viral Programs

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.

0 comments:

Post a Comment