View Code of Problem 53

#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);

    for(int i=1;i<=2*n-1;i++){
    if(i<=n){
        for(int j=n;j>i;j--)
            printf(" ");

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

        for(int j=2*n-2;j>(i-n)*2-1;j--)
            printf("*");
    }printf("\n");
}
return 0;
}

Double click to view unformatted code.


Back to problem 53