Chapter - 3: The Decision Control

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.


G
Sections
2
Exercises

A

B

C

D

E

F

G

H

I

J

K

1

2

3

4

5

6

7

8

9

10

11

13

The following table shows the range of ASCII values for various characters.
A - Z : 65 - 90
a - z : 97 - 122
0 - 9 : 48 - 57
Special Symbols : 0 - 47, 58 - 65, 91 - 96, 123 - 127


#include<stdio.h>
#include<conio.h>
int main()
{
	char c;
	
	printf("Enter a character : ");
	scanf("%c", &c);
	
	if(c>=65 && c<=90)
		printf("\n\nYou've entered a capital letter.");
	else if(c>=48 && c<=57)
		printf("\n\nYou've entered a number.");
	else if(c>=97 && c<=122)
		printf("\n\nYou've entered a small letter.");
	else
		printf("\n\nYou've entered a special symbol.");
	
	getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo