We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b28ea6 commit 18e1a0dCopy full SHA for 18e1a0d
Hollow_Square_Pattern.cpp
@@ -0,0 +1,20 @@
1
+#include <iostream>
2
+using namespace std;
3
+
4
+int main() {
5
+ int n;
6
+ cin >> n; // Input size of the square
7
8
+ for (int i = 0; i < n; i++) {
9
+ for (int j = 0; j < n; j++) {
10
+ // Print '*' if we're at the border
11
+ if (i == 0 || i == n - 1 || j == 0 || j == n - 1)
12
+ cout << "*";
13
+ else
14
+ cout << " ";
15
+ }
16
+ cout << endl;
17
18
19
+ return 0;
20
+}
0 commit comments