红汞药水的作用:Vb中杨辉三角是怎么做的
来源:百度文库 编辑:中科新闻网 时间:2024/05/09 07:08:02
Private Sub Form_Click()
Const N = 10
Dim a(N, N) As Integer
Dim i, j As Integer
a(0, 0) = 1
a(1, 0) = 1
a(1, 1) = 1
For i = 2 To N - 1
a(i, 0) = 1
a(i, i) = 1
For j = 1 To i - 1
a(i, j) = a(i - 1, j - 1) + a(i - 1, j)
Next j, i
For i = 0 To N - 1
For j = 0 To i
Print a(i, j);
Next j
Print
Next i
End Sub