#include <stdio.h>
int main() {
int i, j, space, rows = 5;
for(i = 1; i <= rows; i++) {
// Print leading spaces
for(space = 1; space <= rows - i; space++)
printf(" ");
// Print stars and hollow spaces
for(j = 1; j <= 2*i - 1; j++) {
if(j == 1 || j == 2*i - 1 || i == rows)
printf("*");
else
printf(" ");
}
printf("\n");
}
return 0;
}
*
* *
* *
* *
*********

About the authorSai Kishore Randhi
Embedded systems, VLSI, and chip design
Sai Kishore writes about embedded systems, VLSI, chip design, and the programming concepts behind modern hardware.
View LinkedIn profile ↗