19. Write a Java program to print all ASCII character with their values.
Static :-
class loop19
{
public static void main(String args[])
{
for(int i=0;i<=255;i++)
{
System.out.printf("%c \n",i);
}
}
}
Output :-
Dynamic :-
import java.util.*;
class loop19
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int x,y;
System.out.println("Enter the Starting number :- ");
x=in.nextInt();
System.out.println("Enter the Ending number :- ");
y=in.nextInt();
for(int i=x;i<=y;i++)
{
System.out.printf("%c \n",i);
}
}
}
Output :-