当前位置:编程学习 > VB >>

VB类似杨辉三角形编程

9

89

789

6789

56789

456789

3456789

23456789

123456789

答案:
Private Sub Command1_Click()
Dim a As Integer
a = 5'或6
Text1.Text = getdata(a)
End Sub
Private Function getdata(index As Integer) As Integer
Dim m, n As Integer
m = 1
n = 1
If index < 2 Then
getdata = 1
Exit Function
End If
For i = 2 To index
temp = n
n = m n
m = temp
Next
getdata = n
End Function

上一个:shell编程和VB编程,哪个早一点?哪个好一点
下一个:谁能发VB新手编程的书给我!

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,