關於部落格
開心就好 ,生活就是要活的自在快樂 。 

  • 1366

    累積人氣

  • 0

    今日人氣

    0

    追蹤人氣

VB

Private Sub Cmd1_Click()

    Dim A As Long

    Dim S As Long

    Dim z As Single

      

    S = 1

    For A = 1 To Val(T1)

        S = S * A

        z = z + 1 / S

    Next A

   

    L2.Caption = z

End Sub

 

Private Sub Form_Load()

    T1.Text = ""

    T1.FontSize = 15

    L1.Caption = "1+1/2!+1/3!+1/4!+ ... + 1/N! = "

    L1.FontSize = 15

    L2.Caption = ""

    L2.FontSize = 15

    L3.Caption = "N"

    L3.FontSize = 15

    Cmd1.Caption = "計算"

    Cmd1.FontSize = 15

    Form1.Caption = "1+1/2!+1/3!+1/4!+ ... + 1/N! 之和"

End Sub

EX: 

假如, N=6 ,執行結果如下圖

相簿設定
標籤設定
相簿狀態