#include <cs50.h>
#include <stdio.h>
int main(void)
{
int x;
do
{
x = get_int("Please input an integer that is between 1 and 23: ");
}
while ((x<1) || (x>23));
for (int a=1; a<=x; a++)
{
// print spaces for left pyramid
for (int i=0; i<(x-a); i++)
{
printf(" ");
}
// print hashes
for (int i=0; i<a; i++) // The common for loop starts from "0" instead of "1", so don't write like this (int i=1; i<=a; i++)
{
printf("#");
}
// print gap
printf(" ");
// print hashes for right pyramid
for (int i=0; i<a; i++)
{
printf("#");
}
// print new line
printf("\n");
}
}