I suggest using an array with as many elements as the longest row you need. To keep it simple, keep two copies of the array, and calculate each element of the "new" array as the sum of the corresponding element, plus the previous element, of the "old" array. Then copy the information back for the next step.
10 cls 20 end 30 next 40 print
fd 60 rt 120 fd 60 rt 120 fd 60 rt 120 will cause the turtle to draw a triangle. The square brackets indicate that the enclosed commands are to be executed three times, repeat 3 [fd 60 rt 120] Search Google with: "logo commands triangle" and have a look through the websites on the subject.
10 SCREEN 2 20 PSET (200,120) 30 DRAW "E100 F100 L200" 40 PSET (200,50) 50 DRAW "R200 G100 H100" END
Pascals
To draw a random triangle.... Declare six variables.... H1 and V1 H2 and V2 H3 and V3 Then using the random function apply the random to the height of your form - this will be H1 Do the same with the width of the form - this will be V1 -- do this twice more, for H2 and V2 - and then for H3 and V3.. Then draw a line from (H1, V1) to (H2, V2) Draw another line from (H1, V1) to (H3, V3) Draw the last line from (H2, V2) to (H3, V3) -- I can't guarantee it will look great, but it _will_ be a triangle. ==== To draw a specific triangle you need much more coding, involving sine rule an other trigonometry.
Pascal's triangle
pascal
The Sierpinski Triangle
pascals triangle is used to solve math problems that have chance of 2 different outcomes, such as flipping a coin
in the 11th century...
Blaise Pascal.
(a+b)7
1,4,6,4,1
35
Pascal didn't invent pascals triangle, he just made It popular. A Chinese mathematician invented it in about 1015.
The expanded binomial is another name for Pascal's triangle.
No, use java.