int main(void)
{
int original_height, var_height; // original height and variable height
int row_position;
do
{
printf("height: ");
original_height = GetInt(); //prompt user for input until the value is acceptable
var_height = original_height;
}
while((original_height < 0) || (original_height > 23));
if(original_height > 0)
{
printf("\n");
while(var_height > 0)
{
for(int i = 0; i<(var_height-1) ;i++) // spaces for single row (left)
{
printf(" ");
}
for(row_position = (var_height-2); row_position < (original_height - 1); row_position++) // hashes for single row(left)
{
printf("#");
}
printf(" ");
for(row_position = (var_height-2); row_position < (original_height - 1); row_position++) // hashes for single row(right)
{
printf("#");
}
for(int i = 0; i<(var_height-1) ;i++) // spaces for single row(right)
{
printf(" ");
}
printf("\n");
var_height -=1;
}
}
}
https://sandbox.cs50.net/checks/a692a92e704f474cbe73eeb5439f906b