I have completed Mario.c and now I want to some advance skill on mario.c Like: I want to ask user that how many pyramid they want to have because by default it will only show one pyramid and different height as per user requirement. Need some cooperation. Thanks

2 Answers 2


What you want to do, make something more advanced, is described in the hacker edition of where you have to print two pyramids, as follows:

   #  #
  ##  ##
 ###  ###
####  ####

Try it out here: https://cdn.cs50.net/2015/x/psets/1/hacker1/hacker1.html

  • Thanks Bro ;) but how can i find the source codes ? Commented Jul 20, 2015 at 9:01
  • What do you mean "find the source codes"? You are supposed to write the program.
    – ChrisG
    Commented Jul 20, 2015 at 9:03
  • I have tried simple mario.c but when I am trying to do two pyramids mario then it gives me error Commented Jul 20, 2015 at 11:07
  • Create a new question and post the code you have written and the problem you are facing exactly.
    – ChrisG
    Commented Jul 20, 2015 at 15:35

Sounds like you need to first ask how many pyramids the user wants (probably as a command line argument) and use that in a loop asking for height of each pyramid.

Next question would be whether you intend to draw the pyramids in a line or stacked in a column. Either way, nested loops combined with the original mario.c drawing logic should handle it. You would just need to add the appropriate number of spaces to separate horizontally arranged pyramids or blank lines for vertically separated pyramids.

You must log in to answer this question.

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