题解 | #K形图案#
K形图案
http://www.nowcoder.com/practice/753cc2662d9949fe826a85f815db0ca4
#include<stdio.h>
int main()
{
int n;
while (scanf("%d", &n) != EOF)
{
int i;
for (i = 0; i < n; i++)
{
int j;
for (j = i; j <= n; j++)
printf("* ");
printf("\n");
}
int m;
for (m = 0; m <= n; m++)
{
int k;
for (k = 0; k <= m; k++)
printf("* ");
printf("\n");
}
}
return 0;
}
int main()
{
int n;
while (scanf("%d", &n) != EOF)
{
int i;
for (i = 0; i < n; i++)
{
int j;
for (j = i; j <= n; j++)
printf("* ");
printf("\n");
}
int m;
for (m = 0; m <= n; m++)
{
int k;
for (k = 0; k <= m; k++)
printf("* ");
printf("\n");
}
}
return 0;
}