标签:style color sp for on bs ad amp nbsp
//-------------------*打印菱形*---------------------
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");
}
标签:style color sp for on bs ad amp nbsp
原文地址:http://blog.csdn.net/ytuzhangziyao/article/details/41971349