这是我从前抄的,理解不深,但效果很好:
n = Val(Text1.Text) ' 输入行数.如果只要求输出10行,可去掉这一句,把后面的n换成10
ReDim a(n + 1,n + 1),b(n + 1,n + 1)
Cls
k = 8
For i = 1 To n
Print String((n - i) * k / 2 + 1," ");
For j = 1 To i
a(i,1) = 1
a(i,i) = 1
a(i + 1,j + 1) = a(i,j) + a(i,j + 1)
b(i,j) = Trim(Str(a(i,j)))
Print b(i,j); String(k - Len(b(i,j))," ");
Next j
Next i