Private Sub Form_Click()
Dim A() As Long, N As Integer, I As Integer, J As Integer
N = Val(InputBox("請輸入"))
ReDim A(N, N)
Me.Cls
For I = 1 To N
For J = 1 To I
If J = 1 Or I = J Then
A(I, J) = 1
Else
A(I, J) = A(I - 1, J - 1) + A(I - 1, J)
End If
Next J
Next I
Print A(I, J);
Print
End Sub
Private Sub Form_Click()
Dim A() As Long, N As Integer, I As Integer, J As Integer
N = Val(InputBox("請輸入"))
ReDim A(N, N)
Me.Cls
For I = 1 To N
For J = 1 To I
If J = 1 Or I = J Then
A(I, J) = 1
Else
A(I, J) = A(I - 1, J - 1) + A(I - 1, J)
End If
Next J
Next I
For I = 1 To N
For J = 1 To I
Print A(I, J);
Next J
Print
Next I
End Sub