题解 | #金字塔图案#
金字塔图案
https://www.nowcoder.com/practice/d84e8339f9444bb6b29bd3f227c8e538
#include <stdio.h>
int main() {
int a,i,j,b;
while (scanf("%d", &a) != EOF) { // 注意 while 处理多个 case
// 64 位输出请用 printf("%lld") to
for(i = 1; i <= a ; i ++)
{
for(j = 1; j <= a ; j ++)
{
if(j == a - i + 1)
{
for(b = 1; b <= i; b ++)
{
printf("* ");
}
}
else
{
printf(" ");
}
}
printf("\n");
}
}
return 0;
}
