Five months is too long for a problem like mario or pretty much any other problem in the course.
You could try solving it manually with low-tech tools (e.g., a pencil and a paper) trying to draw half a pyramid row-by-row from top to bottom.
Suppose the input is 5, we should get the following output:
##
###
####
#####
######
By analyzing the problem, we can get a lot of info such as:
- the initial number of spaces to be printed out in terms of the height (i.e., 5) is
height - the initial number of hashes
. - the initial number of hashes is 2.
- the number of spaces decreases each row until it becomes 0 in the last row.
- the number of hashes increases by 1 until it becomes
height + 1
in the last row.
Using these information and a little more, I could write the following pseudocode (assuming height
is a valid integer inputted by the user):
calculate the initial number of spaces in terms of height
calculate the initial number of hashes in terms of height
// draw the rows
for (int i = 0; i < height; i++)
{
// draw spaces
for (int j = 0; j < spaces; j++)
print a space
// draw hashes
for (int j = 0; j < hashes; j++)
print a hash
move to the next row
decrement the number of spaces
increment the number of hashes
}