(int n)
| 12 | // * * |
| 13 | // * |
| 14 | static void pattern5(int n) { |
| 15 | for (int row = 0; row < 2 * n; row++) { |
| 16 | int totalColsInRow = row > n ? 2 * n - row: row; |
| 17 | for (int col = 0; col < totalColsInRow; col++) { |
| 18 | System.out.print("* "); |
| 19 | } |
| 20 | System.out.println(); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | } |