Skip to content

Solution for CS50 PSet 1-C Mario in C, C++, Java and Python.

Notifications You must be signed in to change notification settings

dietms/mario-deshmukhmayur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS50 PSet 1-C: Mario

Toward the end of World 1-1 in Nintendo’s Super Mario Brothers, Mario must ascend a "half-pyramid" of blocks before leaping (if he wants to maximize his score) toward a flag pole. Below is a screenshot.

Mario

Write, in a file called mario.c in your ~/Dropbox/pset1 directory, a program that recreates this half-pyramid using hashes (#) for blocks. However, to make things more interesting, first prompt the user for the half-pyramid’s height, a non-negative integer no greater than 23. (The height of the half-pyramid pictured above happens to be 8.) If the user fails to provide a non-negative integer no greater than 23, you should re-prompt for the same again. Then, generate (with the help of printf and one or more loops) the desired half-pyramid. Take care to align the bottom-left corner of your half-pyramid with the left-hand edge of your terminal window, as in the sample output below, wherein underlined text represents some user’s input.

jharvard@appliance (~/Dropbox/pset1): ./mario
Height: 8
       ##
      ###
     ####
    #####
   ######
  #######
 ########
#########

Note that the rightmost two columns of blocks must be of the same height. No need to generate the pipe, clouds, numbers, text, or Mario himself.

About

Solution for CS50 PSet 1-C Mario in C, C++, Java and Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published