I want to draw a triangle with stars like below using for loop, but i really don\'t have any idea of how to do this ? Triangle is going to be like this:
*
**
**
you just need two loops for your required goal the third loop is useless the first outer loop is for rows and the inner loop is for printing "*".The outerloop is used here for changing the rows and maintaining the number of required rows.
public static void tri()
{
for(int i=0;i<8;i++)
{
for(int j=0;j<=i;j++)
{
System.out.print("*");
}
System.out.println();
}
}