Problem Solving: Capital Letter and Small Letter

Learn to write a program to check if a letter is capital or small with ASCII values.

In this lesson, we will write a program to see if a letter is capital or small.

So let’s get to it!

Capital or small letter

We will use the ASCII table to solve these problems.

Problem statement

Write and run a program that takes a character input from the user and tells whether the character is a capital letter or a small letter.

Sample input


Sample output

Capital Letter

To write a program for the above problem, we first focus on simple logic. The logic is that we need one character as input and compare that input with ASCII numbers.

Let’s break it down.

Let’s say we have a character variable to store letters of the alphabet and a symbol variable to store ASCII values. To check if character is a capital letter or a small letter, we need to typecast this character into a symbol.

This is what we have so far:

Get hands-on with 1200+ tech skills courses.