3.1.21

JAVA program for ASCII values

import java.util.Scanner;

public class ascii 

{

public static void main(String args[])

{



System.out.println("Enter a character");

Scanner sc=new Scanner(System.in);

char ch=sc.next().charAt(0);

int asciivalue=ch;

System.out.println("the ascii value is:" +asciivalue);

}

}

OUTPUT
Enter a character 

a

the ascii value is 97


No comments:

Post a Comment

JAVA program pattern 2

import java.util.Scanner; public class pattern3 { public static void main(String args[]) { int i,j; Scanner sc=new Scanner(System.in); Syste...