“杨辉三角”问题,如图所示,其规律如下:其显著特征是除斜边上的1以外,其余数值均等于其肩部两数之和。编写VB程序,其功能如下:在文本框Text1中输入20以内的整数,点击“打印”按钮,在列表框list1中输出杨辉三角,程序界面如图所示,VB 程序代码如下。
实现上述功能的VB程序如下,请回答下列问题:
Private Sub Command1_Click()
Dim a(20) As Long
Dim i As Integer, j As Integer, s As String List1.Clear
n = Val(Text1.Text)
a(1) = 1
List1.AddItem Str(a(1)) For i = 2 To n
s = ""
For j =
Step -1
a(j) = ①
s = s + Str(a(j))
Next j
② Next i