for(int i = 1; i < 12; i++)
{
for(int k=11; k > i; k--)
{
System.out.print("*");
}
System.out.print("\n");
}
I have the code above which displays a design like this:
**********
*********
********
*******
******
*****
****
***
**
*
I am wanting to swap it so that it looks like this:
**********
*********
********
*******
******
*****
****
***
**
*
I know that I need to use a loop and System.out.print(" ") in some way to leave spaces.
Whats the best approach to use? I created two separate loops, but with the next line commands this wont work in two loops. How would I integrate that into one loop?
ntimes, for example,repeat(char c, int times) { ... }. Then, for each row, you will be calling the function once for spaces, and once for asterisks.