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
Next i
End Sub
很简单,看代码:Private Sub Form1_l
Load
Dim a As Integer
Dim b As Integer
a=Val(Inputbox(“请输入行数”,‘’倒序三角形‘’))
For i =1 To a
Print Tab(i+8)
For j=1 To 11-2*i
Print “*”
Next j
Next i
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)