C
c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
int main () {
int size;
scanf ("%d",&size);
int X=(size / 2) + 1; // Totalrows
int x , y , z; // x = Rows , y = Space z = Stars
for (x = 1;x <= X ; x++) {
for (y = X - x;y >= 1 ;y--) {
printf(" ");
}
for (z = 1;z<=2*x-1;z++) {
printf("*");
}
printf("\n"); // First half of triangle we need to go the next line
}
for (x = X -1;x>=1;x--) {
for (y = 1; y <= X - x ; y++) {
printf(" ");
}
for (z = 1;z<=2*x-1;z++) {
printf("*");
}
printf("\n");
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run