题解 | #箭形图案#
箭形图案
http://www.nowcoder.com/practice/a6d1081e0c9a42f19e42ed6cd91556c1
include<stdio.h>
int main()
{
int a = 0;
while (~scanf("%d", &a))
{
for (int b = 0; b <= a; b++)
{
for (int c = 0; 2 * (a - b) > c; c++)
{
printf(" ");
}
for (int d = 0; d <= b; d++)
{
printf("*");
}printf("\n");
}
for (int e = 0; e < a; e++)
{
for (int f=0; e >= f; f++)
{
printf(" ");
}
for (int j = 0; j < a - e; j++)
{
printf("*");
}printf("\n");
}
}return 0;
}