Java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a character: ");
char ch = sc.next().charAt(0);
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
System.out.println(ch + " is an Alphabet");
} else if (ch >= '0' && ch <= '9') {
System.out.println(ch + " is a Digit");
} else {
System.out.println(ch + " is a Special Character");
}
sc.close();
}
}Output
Enter a character: 9 9 is a Digit
We use character ranges to classify the input as alphabet, digit, or special symbol.