Java
class GetASCII
{
public static void main(String args[])
{
char c;
short AsciiValue;
Scanner SC=new Scanner(System.in);
System.out.print("Enter a character: ");
c=SC.next().charAt(0);
AsciiValue= (short)c;
System.out.println("ASCII value of " + c + " is : " + AsciiValue);
}
}
Find ASCII Value of Character in JAVA
22 May
0
Write a program (WAP) in JAVA to read two numbers from keyboard(User Input) to find ASCII value of a character.
import java.util.Scanner;class GetASCII
{
public static void main(String args[])
{
char c;
short AsciiValue;
Scanner SC=new Scanner(System.in);
System.out.print("Enter a character: ");
c=SC.next().charAt(0);
AsciiValue= (short)c;
System.out.println("ASCII value of " + c + " is : " + AsciiValue);
}
}
Also Read :-
Programs of C
Programs of C++
Programs of Java
Programs of Python
Codes with HTML, CSS, JS
More Questions & Answers
Previous article
Next article
Leave Comments
Post a Comment