Skip to content

Commit 6383ad0

Browse files
Create A_alphabat.cpp
1 parent 447c348 commit 6383ad0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

A_alphabat.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
int n = 6; // Height of the pattern
6+
7+
for (int i = 0; i < n; i++) {
8+
for (int j = 0; j <= n; j++) {
9+
// Print * at required positions
10+
if ((j == n - i) || (j == n + i) || (i == n / 2 && j > n - i && j < n + i)) {
11+
cout << "*";
12+
} else {
13+
cout << " ";
14+
}
15+
}
16+
cout << endl;
17+
}
18+
19+
return 0;
20+
}

0 commit comments

Comments
 (0)