去年,stff577 爱上了求和符号 ∑,但是今年他爱上了两个,请你帮他画一画。
#include<stdio.h>
int main()
{
int n;
int i, j;
scanf("%d", &n);
for ( i = 1; i <= n; i++)printf("***");
for ( i = 1; i <= n; i++)printf(" ");
for ( i = 1; i <= n; i++)printf("***");
printf("\n");
int a = 2, b = 3 * n + 1, c = 4 * n, d = 7 * n - 1;
for ( i = 2; i < 2 * n - 1; i++)
{
for (j = 1; j <= 7 * n; j++)
{
if (j == a || (c-b-1>=2&&(j == b || j == c)) || j == d)printf("*");
else printf(" ");
}
printf("\n");
if(i<n)
{
a++;
b++;
c--;
d--;
}
else {
a--;
b--;
c++;
d++;
}
}for (i = 1; i <= n; i++)printf("***");
for (i = 1; i <= n; i++)printf(" ");
for (i = 1; i <= n; i++)printf("***");
printf("\n");
return 0;
}