~cpp #include <stdio.h> int main() { int b,r,a; int n; printf("홀수인 층수를 입력하시오\n"); scanf("%d",&n); for(r=0;r<(n+1)/2;r=r+1){ for(b=0;b<(n+1)/2-r;b=b+1){ printf(" "); } for(a=n/2;a<n/2+2*r+1;a=a+1){ printf("*"); } printf("\n"); } for(r=0;r<n/2;r=r+1){ for(b=n/2-2;b<n/2+r;b=b+1){ printf(" "); } for(a=0;a<n-2*r-2;a=a+1){ printf("*"); } printf("\n"); } }