main ()
{
int wide,i,j,k,a;
printf("please input number :\n");
scanf("%d",&wide);
k=wide/2+1;
for (i=1;i<=k;i++)/*控制外循环*/
{
for (j=1;j<=k-i;j++)/*用于输出空格*/
printf(" ");
for (a=1;a<=2*i-1;a++)/*使*成奇数输出*/
printf("*");
printf("\n");
}
for (i=1;i<=k-1;i++)
{
for (j=1;j<=i;j++)
printf(" ");
for (a=1;a〈=wide-2*i;a++)
printf("*");
printf("\n");
}
getch();
}