double holoow pyramid star pattern
#include
int main() {
int i, j, n = 5;
for(i = 1; i <= n; i++) {
// Left pyramid
for(j = n; j > i; j--) printf(" ");
for(j = 1; j <= i; j++) printf("* ");
// Inner space
for(j = n; j > i; j--) printf(" ");
// Right pyramid
for(j = 1; j <= i; j++) printf("* ");
printf("\n");
}
}
Code output
* *
* * * *
* * * * * *
* * * * * * * *
* * * * * * * * * *