Any character is entered through the keyboard write a program to determine whether the character entered is a capital letter, a small letter, a digit or a special symbol. The following table shows the range of ASCII values for various characters. 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

Posted: September 23, 2012 in CSE Sem1, ECE Sem1, Lab 11A, Lab 11A
    #include<stdio.h>
    int main()
    {
    char ch;
    printf("Enter a character");
    scanf("%c",&ch);
    if((ch>=65)&&(ch<=90))		
printf("Capital Lette\nr"); 
	else if((ch>=97)&&(ch<=122))
		printf("Small Letter\n");
		else if((ch>=48)&&(ch<=57))
		printf("Number\n");
		else if(((ch>=0)&&(ch<=47))||((ch>=58)&&(ch<=64))||((ch>=91)&&(ch<=96))||((ch>=123)&&(ch<=127)))
	printf("Enter Special Symbol\n");
    return 0;
    }

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

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