#include <cs50.h>
#include <stdio.h>
int main(void)
{
int steps;
// get steps num
do
{
steps = get_int("How tall do you want your pyramid to be? Enter a number between 1-8 (inclusive): ");
}
while ((steps >= 1 && steps <= 8) == false);
// for each step in the pyramid
for (int i = 1; i <= steps; i++)
{
/* for each brick in the step */
// format to make the text look like a pyramid
for (int k = 0; k < (steps - i); k++)
{
printf(" ");
}
// left side of step
for (int j = 0; j < i; j++)
{
printf("#");
}
// sep
printf(" ");
// right side of step
for (int j = 0; j < i; j++)
{
printf("#");
}
printf("
");
}
}