Java program to find Ascii value of input character or symbol

Ascii stands for American Standard Code for Information Interchange.Every character or symbol have its own Ascii value.

import java.util.*;
class scan
{
 public static void main(String arg[])
  {
    char c;
    int x;
   Scanner kb=new Scanner(System.in);
   System.out.println("Enter character or symbol:- ");
  
    c=kb.next().charAt(0);

    x=(int)c;
  System.out.println("Ascii value of "+c+" is: "+x);


}
}

OUTPUT:-

Leave a Reply

Your email address will not be published. Required fields are marked *