I'm very new to programming and I'm trying to complete the cs50 course without just copying other people's code and trying to understand why mine won't work. Currently working on the first C assignment to create a pyramid of #
s but, when I run this code, I run into some issues. It compiles fine but when I run it nothing seems to happen.
Can someone point out why this won't work and/or how to fix this?
#include <stdio.h>
#include <cs50.h>
int main(void)
{
int spaces;
int bricks;
int n;
do
{
n = get_int("Height: ");
}
while (n < 1);
{
for ( int i = 0; i < n; i++)
{
for (spaces = (i - 1); spaces >= 0; spaces++)
{
printf(" ");
}
for (bricks = 1; bricks <= (i + 1); bricks++)
{
printf("#");
}
printf("\n");
}
return 0;
}
}