DWQA Ask QuestionCategory: JavaJava_Q: Ascii Codes from 1 to 122
admin Staff asked 7 years ago

Write Java program to print the table of characters that are equivalent to the Ascii codes from 1 to 122.

2 Answers
admin Staff answered 7 years ago
Start your code here
 public static void print_ascii(int i_num){


//Type Casting a char with int will give Ascii code and vice Versa

for(int i=1;i<=i_num;i++){
System.out.println((char)i);
}



}
Kulkarni Arundhati answered 7 years ago
Start your code here
public class Ascii {

public static void main(String[] args) {
// TODO Auto-generated method stub
String ch;
int i;
for(i=1; i<=122; i++)
{
ch = new Character((char)i).toString();
System.out.print(i+ " -> " + ch + "\t");
}

}

}