题解 | #字符圣诞树#
字符圣诞树
https://www.nowcoder.com/practice/0fae60c3b5c64699b7c0f031c2187dde
#include <stdio.h>
int main() {
int i;
char ch;
scanf("%c",&ch);
for(i=0;i<5;i++)
{
int j;
for(j = 0;j<4-i;j++)
{
printf(" ");
}
for(j = 0;j<i+1;j++)
{
printf("%c ",ch);
}
printf("\n");
}
return 0;
}
查看16道真题和解析