C-Program to check the Nature of Character Entered by User

#include<stdio.h>
 
int main()
{
	char ch;
	printf("Enter any character : ");
	scanf("%c", &ch);
 
	if (ch >= 65 && ch <= 90)
		printf("Character is a capital letter");
	else if (ch >= 97 && ch <= 122)
		printf("Character is a small letter");
	else if (ch >= 48 && ch <= 57)
		printf("Character is a digit");
	else if ((ch > 0 && ch <= 47) || (ch >= 58 && ch <= 64) ||
		(ch >= 91 && ch <= 96) || (ch >= 123 && ch <= 127))
		printf("Character is a Special symbol");
	return 0;
}

Capture.PNG
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s