标签:
//-------------------*打印菱形*---------------------
int i,j,k;
int n;
printf("请输入一个奇数n:");
scanf("%d",&n);
for (i=0; i<n/2; i++) {
for (j=0; j<n/2-i; j++) {
printf(" ");
}
for (k=0; k<=2*i; k++) {
printf("*");
}
printf("\n");
}
for (i=0; i<n; i++) {
printf("*");
}
printf("\n");
for (i=n/2+1; i<n; i++) {
for (j=0; j<i-n/2; j++) {
printf(" ");
}
for (k=0; k<(n-i)*2-1; k++) {
printf("*");
}
printf("\n");
}
标签:
原文地址:http://www.cnblogs.com/bhlsheji/p/4330185.html