在窗体上显示杨辉三角形,如下图所示:如果显示6行,则第1行数字前有5个空格,第2行前有4个空格,第3行数字前有3个空格……
解决该问题的VB程序段如下,在划线处填入正确的语句以实现功能。
Dim a(0 To 10) As Integer
Dim b(0 To 10) As Integer
n = 10
For i = 0 To 10
a(i) = 0
Next
a(1) = 1
b(1) = 1
For i = 1 To n
s = ″ ″
For j = 1 To{#blank#}1{#/blank#}
s = s + ″ ″'在s中加入一个空格
Next
For j = 1 To i
b(j) ={#blank#}2{#/blank#}
s = s + Str(b(j))
Next
Print s
For j = 1 To i
a(j) = b(j)
Next
Next