Squares like stairs

51 views Asked by At

Hello I want a sample program about this pattern using Small Basic which you need to use Turtle here. Thanks Example output

so I was doing this as a sample which it is going to print "*" and I would like the asterisks to be replaced as square shape using turtle. here is the code:

For row = 1 To 10

    For column = 1 To row
       TextWindow.Write("*")
    EndFor

TextWindow.WriteLine("")
EndFor
1

There are 1 answers

0
Eng. M.Hamdy On

I used Small Visual Basic to create the exact shape you are asking for. Small Visual Basic is built on top of Small Basic and has many improvements and additions.

This is how the result will be: enter image description here

and this is the code:

N = 10
Turtle.Speed = 50
GraphicsWindow.BrushColor = Colors.Green
While N > 0
   Turtle.X = 50 * (11 - N)
   Turtle.Y = 600
   For Row = 1 To N
      Turtle.CreateFigure()
      For I = 1 To 4
         Turtle.Move(50)
         Turtle.TurnRight()
      Next
      Turtle.FillFigure()
      Turtle.Move(50)
   Next
   N = N - 1       
Wend