//How to find ascii value print in java
import java.util.*;
public class M
{
public static void main(String args[])
{
String s;
char c;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the value of character for ascii value: ");
s=sc.next();
c=s.charAt(0);
int i;
i=(int)c;
System.out.println("ASCII value="+i);
}
}
OUTPUT:
Enter the value of character for ascii value:
h
ASCII value=104
import java.util.*;
public class M
{
public static void main(String args[])
{
String s;
char c;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the value of character for ascii value: ");
s=sc.next();
c=s.charAt(0);
int i;
i=(int)c;
System.out.println("ASCII value="+i);
}
}
OUTPUT:
Enter the value of character for ascii value:
h
ASCII value=104
No comments:
Post a Comment