#include <stdio.h>

int main() {
    int n;
    scanf("%d",&n);

    for(int i=1; i<=n; i++) {
        //공백
        for(int j=0; j<n-i; j++) {
            printf(" ");
        } 
        if (i==1) printf("*");
        else if(i==n) {
            for(int j=0; j<2*n-1; j++) {
                printf("*");
            }
        } else {
            printf("*");
            for(int j=0; j<2*(i-1)-1; j++) {
                printf(" ");
            }
            printf("*");

    }
            printf("\n");
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: