Write nested for loops to produce the following output:
1
22
333
4444
55555
666666
7777777
Program:
public class Ch02Ex06
{
public static final int LINES = 7;
public static void main(String[] args)
{
for(int r = 1; r <= LINES; r++)
{
for(int c = 1; c <= r; c++)
{
System.out.print(r);
}
System.out.println();
}
}
}
Output:
1
22
333
4444
55555
666666
7777777