题解 | #字符金字塔#
字符金字塔
http://www.nowcoder.com/practice/0fae60c3b5c64699b7c0f031c2187dde
#include<stdio.h>
int main()
{
int i, j;
char a;
scanf("%c", &a);
for (i = 1; i <= 5; i++)
{
for (j = 1; j <6-i; j++)
{
printf(" ");
}
for (j = 6 - i; j <= i + 4; j++)
{
if ((i + j) % 2 == 0)
printf("%c", a);
else
printf(" ");
}
printf("\n");
}
return 0;
}