Would you like to react to this message? Create an account in a few clicks or log in to continue.


您沒有登錄。 請登錄註冊

【VB】費波那契數列級數

向下  內容 [第1頁(共1頁)]

1【VB】費波那契數列級數 Empty 【VB】費波那契數列級數 周日 2月 27, 2011 8:00 pm

Williamd

Williamd
Admin

代碼:
Public Sub Command1_Click()

Dim n, t, a, b, S, Sn As Integer
a = 1
b = 0
S = 0
t = Text1.Text

For n = 2 To t:
S = a + b:
Sn = S:
b = a:
a = S:

Next n



If n = 1 Then
   
    Sn = 1:

Else:

    Sn = S

End If

Label1.Caption = Sn


End Sub

Private Sub Label1_Click()

End Sub

http://c-wind.luntanlong.com

回頂端  內容 [第1頁(共1頁)]

這個論壇的權限:
無法 在這個版面回復文章