Not sure what you mean by "many" if statements, but most people will use two nested for loops to create the bricks - an inner for loop to create each row and an outer for loop to do multiple rows. Then, you only need to create one set of statements to create each brick.
[EDIT - addition]
There's nothing wrong with what you have done. This is a perfect ...
the pseudocode for Mario
for height of pyramid
for (calculate nr. of spaces at height)
print ' '
for (calculate nr. of hashes at height)
print a newline
I'd defer from saying more since, well, that would kill all the fun of the problem :)
Note that you've got other problems, too... your conditions aren't correct. You ...
I am not sure what your problem is, but you can call break at any time, here is an example:
// For loop 1
for (int i = 0; i < n; i++)
// For loop 2
for(int k = 0; k < n; k++)
// When condition b you can break loop 1 and loop 2
if (condition b)
i = n;
Each round counts one vote per voter, for their top preferred, non-eliminated candidate. Once that vote is counted, program moves on to the next voter. From the C99 standard section 188.8.131.52:
A break statement terminates execution of the smallest enclosing switch or
In this case it terminates the the j loop and moves on to the ...
Look at the value of X after you create your first row of bricks. Using your image, that's 9 bricks in the first row. The 10th brick is going to be at x=405, outside the window. How are you going to position the 10th brick as the first brick of the next row? There's something missing. (Trying to make you think instead of just giving the answer. ;-) )
First of all, notice that inside a for loop you can use other variables as well, not only counter. E.g.:
for(counter = 1; counter <= height; counter++)
int row_number = counter;
int hash_quant = counter + 1;
Even further, you don't need to store the quantity counter + 1 in an extra variable. You could simply use it as is, in any ...