#include <stdio.h>
int main() {
int n=5;
for(int i=1;i<=n;i++){
//Print the leading spaces
for(int j=i;j<n;j++){
printf(" ");
}
//Print asterisks
for(int k=1;k<=2*i-1;k++){
if(k==1||k==2*i-1||i==n){
printf("*");
}else{
printf(" ");
}
}
//Move to the next line after each row
printf("\n");
}
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: