1个回答
展开全部
Private Sub Form_click()
n= inputbox("输入整数n:")
Dim shuzuer() As Long
Dim shuzu() As Integer
Dim i As Integer
Dim j As Integer
reDim shuzuer(1 To n, 1 To n)
reDim shuzu(1 To n)
Me.Cls
i = 1
j = 1
For i = LBound(shuzuer, 1) To UBound(shuzuer, 1)
For j = LBound(shuzuer, 2) To i
If j = 1 Or j = i Then
shuzuer(i, j) = 1
Else
shuzuer(i, j) = shuzuer(i - 1, j - 1) + shuzuer(i - 1, j) '要打印的数值
End If
Print Tab(5 * (UBound(shuzuer, 1) - 1) - 5 * (i - 1) + 10 * (j - 1)); shuzuer(i, j); '打印成三角形状
Next
Print
Next
End Sub
n= inputbox("输入整数n:")
Dim shuzuer() As Long
Dim shuzu() As Integer
Dim i As Integer
Dim j As Integer
reDim shuzuer(1 To n, 1 To n)
reDim shuzu(1 To n)
Me.Cls
i = 1
j = 1
For i = LBound(shuzuer, 1) To UBound(shuzuer, 1)
For j = LBound(shuzuer, 2) To i
If j = 1 Or j = i Then
shuzuer(i, j) = 1
Else
shuzuer(i, j) = shuzuer(i - 1, j - 1) + shuzuer(i - 1, j) '要打印的数值
End If
Print Tab(5 * (UBound(shuzuer, 1) - 1) - 5 * (i - 1) + 10 * (j - 1)); shuzuer(i, j); '打印成三角形状
Next
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询