Upside down Triangle pattern
Hi Sorry if this is something that is often posted but I don't understand why the way I did it doesn't work and I'd like to find out why it doesn't.
The first triangle i did started as such
*
**
***...
This time I'd like to switch it upside down as follows
***
**
*
I did this by using the loop the opposite as I did with the first and instead of having j = 0 and incrementing it, i made j = n and decremented j.
Code:
// loop N times, one for each row
for (int i = n; i <= n; i--) {
// print j periods
for (int j = i; j <= i; j--)
System.out.print("*");
// print a new line
System.out.println();
}
But it rolls infinitely... :S
Any help is greatly appreciated!