Difference between revisions of "Print Shapes Exercises"

From WLCS
(New page: '''Objective:''' * Become more familiar with looping and printing to the screen '''Print Rectangle''' * Prompt the user for a height number * Prompt the user for a width number * Using t...)
 
m (Protected "Print Shapes Exercises" [edit=sysop:move=sysop])
(No difference)

Revision as of 14:06, 26 November 2008

Objective:

  • Become more familiar with looping and printing to the screen

Print Rectangle

  • Prompt the user for a height number
  • Prompt the user for a width number
  • Using the height and width, print out a rectangle of *s.
  • Example:
      h = 3
      w = 5

      *****
      *****
      *****

Print Triangle

  • Prompt the user for a number N
  • Print out a triangle that looks like the following:
  • Example:
      N = 4

      *
      **
      ***
      ****