Ad

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.


Ad
G
Sections
2
Exercises

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;
}
Ad

© 2024 Garbage Valuegarbage value logo