1

Newbie here. Apparently missing something here I can't even decipher the error message. Please let me know what went wrong! Thank you!

int main(void)
{
int height;
    do
    {
        printf("Height (0-23)?: ");
        height = get_int();
    }
    while (height < 0 || height > 23);

    int row, space, hash;
    for (row = 0, row < (height - 1), row++){
        for (space = 0, space < height - row, space++){
        printf(" ");
        }
        for (hash = 0, hash < row, hash++){
        printf("#");
        }
        printf("  ");
        for (hash = 0, hash < row, hash++){
        printf("#");
        }
    printf("\n");
}

And here 's the error message:

enter image description here

0

2 Answers 2

2

An easy issue to fix. The syntax of your for loop is incorrect. A for loop statement has three clauses. The clauses are separated by semicolons as in:

    for( x = 0; x < 10; x++) {...}

Your code has commas where it should have semicolons.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

2

There are just some syntax errors. Remember mate the general format of for loop is: for(initialize ; condition ; increment/decrement)

so in for loop you've used comma(,) instead of semicolon(;). Your program will not produce desired output for mario there are some logical errors which you've to find yourself. All the Best mate!!

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .