*4.8 (Find the character of an ASCII code) Write a program that receives an ASCII code (an integer between 0 and 127) and displays its character. Here is a sample run:
Enter an ASCII code: 69
The character for ASCII code 69 is E
Enter an ASCII code: 69
The character for ASCII code 69 is E
import java.util.Scanner; public class ProgrammingEx4_8 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter an ASCII code:"); int s = input.nextInt(); System.out.print("The character for ASCII code " + s + " is " + (char) s); }
No comments:
Post a Comment