题解 | #箭形图案#
箭形图案
http://www.nowcoder.com/questionTerminal/a6d1081e0c9a42f19e42ed6cd91556c1
int main()
{
int a, b, n;
int i;
while (scanf("%d", &n) != EOF)
{
for (i = 0 ; i <= n; i++)
{
for (a = 0; a < 2 * (n-i); a++)
{
printf(" ");
}
for (b = 0; b < i+1; b++)
{
printf("*");
}
printf("\n");
}
for (i = 0 ; i < n ; i++)
{
for (a = 0; a < 2*i + 2 ; a++)
{
printf(" ");
}
for (b = 0; b < n - i; b++)
{
printf("*");
}
printf("\n");
}
}
return 0;
}