|
|
|
@ -0,0 +1,51 @@
|
|
|
|
|
#include<stdio.h>
|
|
|
|
|
void diamond(int a)
|
|
|
|
|
{
|
|
|
|
|
int b,c,d,t;
|
|
|
|
|
d=0;
|
|
|
|
|
t=a;//<2F><><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD>t
|
|
|
|
|
while(a--)//<2F>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
for(b=0; b<a; b++)
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
printf("*");
|
|
|
|
|
for(c=1; c<d; c++)//<2F><><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2>ո<EFBFBD><D5B8><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
printf("*");
|
|
|
|
|
}
|
|
|
|
|
if(d!=0)printf("*");
|
|
|
|
|
printf("\n");//һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
d=d+2;
|
|
|
|
|
}//<2F><><EFBFBD>ε<EFBFBD><CEB5>ϰ벿<CFB0><EBB2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
a=t;
|
|
|
|
|
d=d-2;
|
|
|
|
|
a= a- 1;
|
|
|
|
|
d=0;
|
|
|
|
|
while(a--)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD><CEB5>°벿<C2B0><EBB2BF>
|
|
|
|
|
{
|
|
|
|
|
for(c=1; c<(t-a); c++)
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
printf("*");
|
|
|
|
|
for(c=0; c<a*2-1; c++)
|
|
|
|
|
{
|
|
|
|
|
printf("*");
|
|
|
|
|
}
|
|
|
|
|
d=d+2;
|
|
|
|
|
if(a!=0)
|
|
|
|
|
printf("*");
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
int n;
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
diamond(n);
|
|
|
|
|
}
|