How exactly should I formulate the loop to print the following statement?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hrstissiaopai
    New Member
    • Mar 2013
    • 27

    How exactly should I formulate the loop to print the following statement?

    I am trying to print the following pattern:

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

    Help, please! Oh, and if you could write actual code and not just psedocode that would be greatly appreciated, but if you can't, then write in psedocode. Thanks in advance!
    Last edited by acoder; Mar 25 '13, 08:12 PM. Reason: Edited question
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    What you'll need to do is something like this
    Code:
    loop i from 1 to 7
       loop j from 1 to i
          print *
       end loop
    
       print new line
    end loop
    That will give you the first half. You just need to reverse the loop for the rest of it.

    Comment

    Working...