Pascal's triangle: Difference between revisions
Content deleted Content added
PatGarrett (talk | contribs) m →{{header|360 Assembly}}: shorter |
PatGarrett (talk | contribs) →{{header|Visual Basic}}: Section added |
||
Line 3,520:
1 5 10 10 5 1
</pre>
=={{header|Visual Basic}}==
{{works with|Visual Basic|VB6 Standard}}
<lang vb>
Sub pascaltriangle()
'Pascal's triangle
Const m = 11
Dim t(40) As Integer, u(40) As Integer
Dim i As Integer, n As Integer, s As String, ss As String
ss = ""
For n = 1 To m
u(1) = 1
s = ""
For i = 1 To n
u(i + 1) = t(i) + t(i + 1)
s = s & u(i) & " "
t(i) = u(i)
Next i
ss = ss & s & vbCrLf
Next n
MsgBox ss, , "Pascal's triangle"
End Sub 'pascaltriangle
</lang>
{{out}}
<pre>
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1
1 10 45 120 210 252 210 120 45 10 1
</pre>
=={{header|Vedit macro language}}==
|