main()
{int i,j,k;
for(i=0;i<=3;i++)
{for(j=0;j<=2-i;j++)
printf(" ");
for(k=0;k<=2*i;k++)
printf("*");
printf("\n");
}
for(i=0;i<=2;i++)
{for(j=0;j<=i;j++)
printf(" ");
for(k=0;k<=-2*i;k++)
printf("*");
printf("\n");
}
}
这绝对正确,because我是从书里翻出来的
main()
{int i,j;
for(i=1;I<=4;i++) /*控制输入4行*/
{for(j=1;j<=8-2*i;j++)
printf(“ “) /*控制输入空格*/
for(j=9-2*i;j<=5+2*i;j++)
{if(j%2==0)printf(“ “);
else printf(“*”); } /*控制输入*号*/
printf(“\n”);
}
for(I=3;I>=1;I--)
(for(j=1;j<=8-2*I;j++)
printf(“ “);
for(j=9-2*I;j<=5+2*I;j++)
{if(j%2==0)printf(“ “);
else printf(“*”);}
printf(“\n”);
}
}