Commit f4647c0
committed
feat: Print hollow square star pattern using nested loops
🧠 Logic:
- Read integer `n` to define size of the square.
- Use nested loops: outer loop for rows (`i`), inner loop for columns (`j`).
- Print `*` if the current position is on the border:
- First or last row (`i == 1 || i == n`)
- First or last column (`j == 1 || j == n`)
- Else, print a space to create the hollow effect inside the square.
Signed-off-by: Somesh diwan <[email protected]>1 parent 92a41df commit f4647c0
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
0 commit comments