35 lines
998 B
C
35 lines
998 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
int n, astCount, spaceCount, outAstCount, outSpaceCount;
|
|
scanf("%d", &n);
|
|
spaceCount = (n-1)/2;
|
|
if (n > 2 && n % 2 == 1) {
|
|
for(astCount = 1; astCount <= n; astCount+=2){
|
|
for (outSpaceCount = 0; outSpaceCount < spaceCount; outSpaceCount++) {
|
|
printf(" ");
|
|
}
|
|
for (outAstCount = 0; outAstCount < astCount; outAstCount++) {
|
|
printf("*");
|
|
}
|
|
printf("\n");
|
|
spaceCount--;
|
|
}
|
|
astCount = n-2;
|
|
spaceCount = 1;
|
|
for(; astCount > 0; astCount-=2) {
|
|
for (outSpaceCount = 0; outSpaceCount < spaceCount; outSpaceCount++) {
|
|
printf(" ");
|
|
}
|
|
for (outAstCount = 0; outAstCount < astCount; outAstCount++) {
|
|
printf("*");
|
|
}
|
|
printf("\n");
|
|
spaceCount++;
|
|
}
|
|
}
|
|
else{
|
|
printf("input error");
|
|
}
|
|
return 0;
|
|
} |