Previous Next
0 / 13
Module DEMO-32-56DEMO-C-32

Character Type Classifier

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a C program that reads a single character from standard input and determines whether it is an alphabet letter (A-Z or a-z), a digit (0-9), or a special character (any other character).

The program should output one of the following messages based on the character type:

  • "This is an alphabet." for letters
  • "This is a digit." for numeric digits
  • "This is a special character." for all other characters

Use appropriate conditional statements to classify the character based on its ASCII value.

Constraints

The input will be a single valid ASCII character The program must read from standard input The program must write to standard output Use only standard C library functions

Input Format

A single character from standard input.

Output Format

Print exactly one of the following lines based on the input character:

  • "This is an alphabet."
  • "This is a digit."
  • "This is a special character."

The output must end with a newline character.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
@
This is a special character.
The @ symbol is not a letter or digit, so it's classified as a special character.
Sample #2
Public sample
A
This is an alphabet.
Uppercase letter A should be classified as an alphabet character.
Sample #3
Public sample
z
This is an alphabet.
Lowercase letter z should be classified as an alphabet character.
Sample #4
Public sample
5
This is a digit.
The digit 5 should be classified as a digit character.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings