(int n)
| 10 | // * |
| 11 | |
| 12 | static void pattern3(int n) { |
| 13 | for (int row = 1; row <= n; row++) { |
| 14 | // for every row, run the col |
| 15 | for (int col = 1; col <= n-row+1; col++) { |
| 16 | System.out.print("* "); |
| 17 | } |
| 18 | // when one row is printed, we need to add a newline |
| 19 | System.out.println(); |
| 20 | } |
| 21 | } |
| 22 | } |