0

I am stuck on how to build Mario's half-pyramid. I know that you can use a for loop to create the spaces and hashes. Whenever I try to execute the for loop, it doesn't print out the hashes or spaces. I'm not sure what I did wrong. Here is what I have so far:

int main(void)

{

do

{

printf("Height: ");

int i = GetInt( );

}

while (i < 0 || i > 23);

for (int i = 0; i < 10; i++);

{

printf(" ");

printf("#");

}

}

I followed the walkthrough about it and tried finding the pattern. I came up with n(line number)+2 for the hashes and i(height)-1 for the spaces. I'm not sure how to incorporate them.

0

there are some things you might want to rethink. You named your GetInt i, but you are using int i later again for a different purpose... This might end up being confusing... Also one for loop might not be enough. Remember you need height, spaces and hashes. Each of them needs to implemented and printed... For you excisting for loop: what if the user chooses a height of ten? You also want to print a new line at some point. I leave it you to think about it... I myself hated mario.c but it´s getting better!! ;-)

| improve this answer | |

You must log in to answer this question.

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