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