VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 8775
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 8775
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox pic1
Height = 2295
Left = 180
ScaleHeight = 2235
ScaleWidth = 8235
TabIndex = 2
Top = 600
Width = 8295
End
Begin VB.TextBox txt1
Height = 375
Left = 2580
TabIndex = 1
Text = "10"
Top = 120
Width = 1095
End
Begin VB.CommandButton cmd1
Caption = "Command1"
Height = 360
Left = 180
TabIndex = 0
Top = 120
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Cmd1_Click()
Dim n As Long
n = CLng(Val(Me.txt1.Text))
Dim a() As Integer
Dim i, j As Integer
Dim s As String
ReDim a(n, n)
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
Next i
s = ""
For i = 0 To n - 1
s = s & vbCrLf
For j = 0 To i
s = s & vbTab & a(i, j)
Next j
Next i
Me.pic1.Print s
End Sub
把以上文字贴到一文本文件里 然后改后缀为.frm 运行查看效果