题解 | #字符金字塔#
字符金字塔
http://www.nowcoder.com/practice/0fae60c3b5c64699b7c0f031c2187dde
#include <stdio.h>
int main(){
char ch;
int i = 0;
int j = 0;
scanf("%c",&ch);
// 一共五层
for(i=0;i<5;i++){
// 打印空格
for(j=0;j<5-1-i;j++){
printf(" ");
}
// 打印字符
for(j=0;j<=i;j++){
printf("%c ",ch);
}
printf("\n");
}
return 0;
}