Challenge: Check if the Given Character is an Alphabet

Test our understanding by solving a slightly difficult challenge in this lesson.

Problem statement

In this challenge, you are given a character. Your task is to find whether the given character is an upper-case alphabet, a lower-case alphabet, or a non-alphabetic character.

Input

We have already initialized the variable character at the backend.

Output

  • If the character is an upper-case alphabet, your program should print the upper-case alphabet to the console.

  • If the character is a lower-case alphabet, your program should print the lower-case alphabet to the console.

  • If the character is a non-alphabetic character, your program should print not an alphabet to the console.

Sample input

char character = 'a';

Sample output

lower-case alphabet

Coding exercise

Before diving directly into the solution, try to solve it yourself. Then, check if your code passes all the test cases.

📝 Please use the variable character for the input and print your output on the console, or your code will not execute.

Good luck! 👍

Get hands-on with 1200+ tech skills courses.