I've been working on this for days now, and have reached a point where I'm afriad I've gone further away from the LOGIC of the problem. At the moment, the complier doesn't print out line 16 and yet when I enter a number I do get a pyramid, only the spaces/hashes don't work properly.
// a programme that builds a half-pyramid, according to user's input
#include <stdio.h>
#include <cs50.h>
int main(void)
{
int height = GetInt();
int lines;
int spaces;
int hashes;
do
{
printf("height of pyramid: "); //prompts user input
}
while ((height < 0) || (height > 23));
for(lines = 0; lines <= height; lines++)
{
for(spaces = (lines-height); spaces > 0; spaces--)
{
printf(" ");
}
for(hashes = 1; hashes <= (lines +1); hashes++)
{
printf("#");
}
printf("\n");
}
return 0;
}