#include <stdio.h> int main() { int size = 5; //printf(">\n"); //scanf("%d",&size); for(int h = 0; h < size; h++) { for(int i = size - h; i>=0; i--) //5-1-2-3-4 print spaces... { printf(" "); } for(int w = 0; w < h*2+1; w++) //column { printf("*"); } printf("\n"); } //first half of the triangle ends for(int h = size -2; h >= 0; h--) //second half,upside down triangle begins { for(int i = size - h; i >= 0; i--) //printing space { printf(" "); } for(int w = 0 ;w < h*2+1; w++) { printf("*"); } printf("\n"); } return 0; }