Wrote a code to output a triangle:
int n = key.nextInt(); for (int i = 0; i <= n; i++) { for (int j = i; j > 0; j--) { System.out.print("* "); } System.out.println(); } Result:
* * * * * * * * * * How to display this triangle in the reverse order:
* ** *** ****