#include<stdio.h>#include<cs50.h>intmain(void){intheight=-1;while(height>8||height<1){height=get_int("Height: ? ");}for(inti=0,j=height-1;i<height;i++,j--)//i for height, j for space before each level
{for(intk=0;k<2;k++)//loop for right half and left half
{if(k==0)//for left half
{if(j!=0)//if Height is one, skip output space before each level
{for(intl=0;l<j;l++)//print space before each level
{printf(" ");}}for(intm=0;m<=i;m++)//print left half #
{printf("#");}printf(" ");//space between left half and right half
}else{for(intm=0;m<=i;m++)//print right half #
{printf("#");}}}printf("\n");//new line before next level
}}