i have to make a screen output final with variable which will set the height of atree.a the while loop has to be used.im kinda stuck to figuring this all out.
the tree has to look like this
*
***
*****
*******
*********
***
so far all i have is
public class MainTree {
public static void main(String[] args) {
int column = 1;
int first = column;
int height_of_tree = 6;
int last = height_of_tree;
while (column <= last)
{
int row = 2;
int space = last - 1;
int space_counter = -1;
space_counter++;
while (space != space_counter)
{
System.out.print(" ");
space = space - 1;
}
while (row <= column + 1)
{
System.out.print("*");
row++;
}
System.out.print("\n");
column++;
}
}
and i get
*
**
***
****
*****
******
facing only one right side