lucproblem003.c (1085B)
1 /* If a character is entered through the keyboard, Write a program 2 to determine whether the character is a capital letter, a small case letter, 3 a digit or a speacial symbol. 4 The following table shows the range of ASCII values for various characters : 5 Characters ASCII Values 6 A - Z 65 - 90 7 a - z 97 - 122 8 0 - 9 48 - 57 9 special symbols 0 - 47, 58 - 64, 91 - 96, 123 - 127 10 */ 11 /* Let Us C, Chap - 4, Page - 65, Problem 4.2 */ 12 13 #include <stdio.h> 14 int main() 15 { 16 char inp; 17 printf("Enter one character : "); 18 scanf(" %c", &inp); 19 if (inp >= 64 && inp <= 90) 20 printf("\nInput '%c' is a CAPITAL LETTER.", inp); 21 if (inp >= 97 && inp <= 122) 22 printf("\nInput '%c' is a SMALL CASE LETTER.", inp); 23 if (inp >= 48 && inp <= 57) 24 printf("\nInput '%c' is a DIGIT.", inp); 25 if (inp >= 0 && inp <= 47 || inp >= 58 && inp <= 64 26 || inp >= 91 && inp <= 96 || inp >= 123 && inp <= 127) 27 printf("\nInput '%c' is a SPECIAL SYMBOL.", inp); 28 return 0; 29 }