Write nested for loops to produce the following output:
1
2
3
4
5
Program:
public class Ch02Ex07
{
public static final int LINES = 5;
public static void main(String[] args)
{
for(int r = 1; r <= LINES; r++)
{
for(int c = 1; c <= LINES - r; c++)
{
System.out.print(" ");
}
System.out.println(r);
}
}
}
Output: