write a program in java to print the pattern using ASCII and nested for loop.
Attachments:
Answers
Answered by
4
Answer:
public class HelloWorld
{
public static void main(String []args)
{
for(int x=65;x<69;x++)
{
for(int y=65;y<=x;y++)
{
System.out.print((char)y);
}
System.out.println();
}
}
}
Explanation:
ASCII code of A is 65
So loop starts from 65 and goes to 69 (for D)
Hope it helps :-)
Similar questions