From 02068419a2c35add9a999cb03f32c2908267394e Mon Sep 17 00:00:00 2001 From: Gautami Sinha <39949838+amnotcreative@users.noreply.github.com> Date: Sat, 22 Oct 2022 17:33:56 +0530 Subject: [PATCH] Prints ASCII value of an entered character In the program the user can enter any character and the corresponding ASCII value will be printed! --- Java Basic Program/ASCII Value | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Java Basic Program/ASCII Value diff --git a/Java Basic Program/ASCII Value b/Java Basic Program/ASCII Value new file mode 100644 index 0000000..b7d4cb9 --- /dev/null +++ b/Java Basic Program/ASCII Value @@ -0,0 +1,12 @@ +import java.util.Scanner; +public class PrintAscii +{ + public static void main(String args[]) + { + System.out.print("Enter a character: "); + Scanner sc = new Scanner(System.in); + char chr = sc.next().charAt(0); + int asciiValue = chr; + System.out.println("ASCII value of " +chr+ " is: "+asciiValue); + } +}