Coders Packet

Program to find entered character is capital, small, digit or special symbol in Java

By Ginna Srilekha

We will write a program to determine entered character is a capital letter, small case letter, digit, or special symbol.

So First we should take character input from user. Now the character in variable c.Take another variable ascii and make ascii=c.ascii variable stores

ascii value of character.

Now we know that A-Z has ascii values  65-90, a-z has ascii values 97-122, 0-9 has ascii values 48-57, special symbols have ascii values 0-47,58-64,


According to this we should insert the conditions in if else statements.

import java.util.Scanner;
public class HelloWorld {
    public static void main(String[] args) {
    Scanner s=new Scanner(;
    char c;
    int ascii;;   
    if(ascii>64 && ascii <91)
    System.out.println("Capital letter");
    else if(ascii>96 && ascii <123)
    System.out.println("small letter");
    else if(ascii>47 && ascii <58)
    else if((ascii >=0 && ascii<=47)||(ascii >=58 && ascii<=64)||(ascii >=91 && ascii<=96)||(ascii >=123 && ascii<=127))
    System.out.println("Special Symbols");




1) G

    Capital letter

2) s

    small letter

3) 96


4)   ( )space

    special symbol

Download Complete Code


No comments yet