0

Good morning, I want to ask you a questions, that I really need. Its about the pyramid in Mario. Please look my code

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

Im not sure whats wrong. maybe the condition in the second for loop but i dont know how to handle it.i will wait for your answer. thanksss

1

In a for loop you don't state the end criteria, but think about it more like a while criteria.

This means instead of spaces = row - 1; you need to use spaces <= row - 1;

You must log in to answer this question.

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