满意答案
ya328417429
2013.09.09
采纳率:48% 等级:12
已帮助:5724人
Option Explicit
Private Sub Form_Click()
Dim A() As Long, N As Integer, I As Integer, J As Integer, X As Integer
N = Val(InputBox("请输入打印行数<=16", "输入正整数", 16))
If N > 16 Or N <= 0 Then
MsgBox "数值错误,重新输入行数"
N = 0
End If
ReDim A(N, N)
Frm10.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
Print Spc(75 - 3 * I);
For J = 1 To I
Print A(I, J);
X = Len(CStr(A(I, J)))
If X = 1 Then Print Spc(3);
If X = 2 Then Print Spc(2);
If X = 3 Then Print Spc(1);
Next J
Next I
End Sub
00分享举报