View Code of Problem 53

#include <stdio.h>
#include <string.h>

int main() {
    int size;
    scanf("%d", &size);
    for(int i=0; i<size; i++) {
        for(int j=0; j<size - i - 1; j++) {
            printf(" ");
        }
        for(int j=0; j<=2 * i; j++) {
            printf("*");
        }
        printf("\n");
    }
    
    for(int i=size - 2; i>=0; i--) {
        for(int j=0; j<size - i - 1; j++) {
            printf(" ");
        }
        for(int j=0; j<=2 * i; j++) {
            printf("*");
        }
        printf("\n");
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 53