Java Program To Find ASCII Value Of Character

Write Java program to find ASCII value of given character

// WAP to find Ascii value of given character

import java.util.Scanner;
public class AsciiValue
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter a character :-->");
        char c = sc.next().charAt(0);
        
        int ascii = (int)c;

        System.out.println("Ascii value of "+c+" is : "+ascii);
        

    }
}

Output:


<< Previous | Next >>


Leave a Reply

Your email address will not be published.