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

  • 1355

    累積人氣

  • 0

    今日人氣

    0

    訂閱人氣

VB

Private Sub Command1_Click()

 

 

    Dim a As Integer

 

 

    Dim b As Integer

 

 

   

 

 

    For a = 1 To Val(Text1.Text)

 

 

                    b = b + a

 

 

    Next a

 

 

    Label3 = b

 

 

End Sub

 

 

Private Sub Form_Load()

 

 

    Text1.Text = ""

 

 

    Label1.Caption = "N="

 

 

    Label2.Caption = "1+2+3+...+N="

 

 

    Command1.Caption = "計算"

 

 

    Form1.Caption = "1+2+3+...+N=?"

 

 

    Label3.Caption = ""

 

 

      Label3.BackColor = QBColor(11)

 

 

End Sub




1+3+5+ ... +99之和

Private Sub Command1_Click()

 

    Dim a As Integer

 

    Dim b As Integer

 

   

 

    For a = 1 To 99 Step 2

 

        b = b + a

 

    Next a

 

    Label2 = b

 

End Sub

 

 

Private Sub Form_Load()

 

    Form1.Caption = "1+3+5+...+99=?"

 

    Command1.Caption = "計算"

 

    Label1.Caption = "1+3+5+...+99="

 

    Label2.Caption = ""

 

    Label2.BackColor = QBColor(11)

 

End Sub




 2+4+6+ ... +100之和


Private Sub Command1_Click()

 

    Dim a As Integer

 

    Dim b As Integer

 

   

 

    For a = 2 To Val(Text1.Text) Step 2

 

        b = b + a

 

    Next a

 

    Label3 = b

 

End Sub

 

Private Sub Form_Load()

 

    Form1.Caption = "2+4+6+...+N=?"

 

    Label1.Caption = "N="

 

    Text1.Text = ""

 

    Label2.Caption = "2+4+6+...+N="

 

    Label3.Caption = ""

 

    Label3.BackColor = QBColor(11)

 

    Command1.Caption = "計算"

 

End Sub 



1+1/2+1/3+ ... +1/N之和

Private Sub Command1_Click()

 

    Dim i As Single

 

    Dim sum As Single

 

   

 

    For i = 1 To Val(Text1.Text)

 

        sum = sum + 1 / i

 

    Next i

 

    Label3 = sum

 

End Sub

 

Private Sub Form_Load()

 

    Command1.Caption = "計算"

 

    Label1.Caption = "N="

 

    Label2.Caption = "1+1/2+1/3+...+1/N="

 

    Label3.Caption = ""

 

    Label3.BackColor = QBColor(11)

 

    Text1.Text = ""

 

    Form1.Caption = "1+1/2+1/3+...+1/N=?"

 

End Sub

 

1^2+2^2+3^2+......+N^2之和

Private Sub Command1_Click()

 

    Dim x As Integer

 

    Dim y As Integer

 

    Dim z As Integer

 

    Dim a As Long

 

    x = 1

 

    For y = 1 To Val(Text1.Text)

 

        z = y * x

 

        x = x + 1

 

        a = a + z

 

    Next y

 

    Label3 = a

 

End Sub

 

 

Private Sub Form_Load()

 

    Text1.Text = ""

 

    Command1.Caption = "計算"

 

    Label1.Caption = "N="

 

    Label2.Caption = "1^2+2^2+3^2+...+N^2="

 

    Label3.BackColor = QBColor(11)

 

    Label3.Caption = ""

 

    Form1.Caption = "1^2+2^2+3^2+...+N^2=?"

 

End Sub

 

1*2+2*3+3*4+.....+N*(N+1)之和

Private Sub Command1_Click()

 

    Dim a As Integer

 

    Dim b As Integer

 

    Dim c As Integer

 

    Dim d As Integer

 

   

 

    For a = 1 To Val(Text1.Text)

 

        b = a + 1

 

        c = b * i

 

        d = d + c

 

    Next a

 

    Label3 = d

 

End Sub

 

 

Private Sub Form_Load()

 

    Command1.Caption = "計算"

 

    Label1.Caption = "N="

 

    Label2.Caption = "1*2+2*3+3*4+...+N*(N+1)="

 

    Label3.Caption = ""

 

    Label3.BackColor = QBColor(11)

 

    Form1.Caption = "1*2+2*3+3*4+...+N*(N+1)=?"

 

    Text1.Text = ""

 

End Sub

 

N!  

 


Private Sub Command1_Click()

 

    Dim a As Long

 

    Dim s As Long

 

   

 

    s = 1

 

    For a = 1 To Val(Text1.Text)

 

        s = s * a

 

    Next a

 

    Label3 = s

 

End Sub

 

 

Private Sub Form_Load()

 

    Command1.Caption = "計算"

 

    Label1.Caption = "N="

 

    Label2.Caption = "N!="

 

    Label3.Caption = ""

 

    Label3.BackColor = QBColor(11)

 

    Text1.Text = ""

 

    Form1.Caption = "1*2*3*...*N=?"

 

End Sub

 

1!+2!+3!+4!+ ... +N! 之和 

 


Private Sub Command1_Click()

 

    Dim x As Long

 

    Dim y As Long

 

    Dim z As Long

 

   

 

    y = 1

 

    For x = 1 To Val(Text1.Text)

 

       y = y * x

 

       z = z + y

 

    Next x

 

    Label3 = z

 

End Sub

 

 

Private Sub Form_Load()

 

    Command1.Caption = "計算"

 

    Label1.Caption = "N="

 

    Label2.Caption = "1!+2!+3!+...+N!="

 

    Label3.Caption = ""

 

    Label3.BackColor = QBColor(11)

 

    Form1.Caption = "1!+2!+3!+...+N!=?"

 

    Text1.Text = ""

 

End Sub

 

 

1+1/2!+1/3!+1/4!+ ... + 1/N! 之和  

 


Private Sub Command1_Click()

 

    Dim x As Long

 

    Dim y As Long

 

    Dim z As Single

 

   

 

    y = 1

 

    For x = 1 To Val(Text1.Text)

 

       y = y * x

 

       z = z + 1 / y

 

    Next x

 

    Label3 = z

 

End Sub

 

 

Private Sub Form_Load()

 

    Command1.Caption = "計算"

 

    Label1.Caption = "N="

 

    Label2.Caption = "1+1/2!+1/3!+...+1/N!="

 

    Label3.Caption = ""

 

    Label3.BackColor = QBColor(11)

 

    Form1.Caption = "1+1/2!+1/3!+...+1/N!=?"

 

    Text1.Text = ""

 

End Sub

 

1!+3!+5!+7!+ ... +N! 之和

Private Sub Cmd1_Click()

 

    Dim A As Long

 

    Dim S As Long

 

    Dim z As Long

 

    Dim Q As Single

 

 

 

    If Val(T1.Text) Mod 2 < > 0 Then

 

        For A = 1 To T1 Step 2

 

            S = 1

 

            For Q = 1 To A

 

                S = S * Q

 

            Next Q

 

            z = Val(z) + Val(S)

 

        Next A

 

        L3.Caption = z

 

    Else

 

        L3.Caption = "N請輸入奇數"

 

    End If

 

  End Sub

 

 

Private Sub Form_Load()

 

    T1.Text = ""

 

    L2.Caption = "1!+3!+5!+...+N!="

 

    L3.Caption = ""

 

    L1.Caption = "N(請輸入奇數)"

 

    Cmd1.Caption = "計算"

 

    Form1.Caption = "1!+3!+5!+...+N!=?"

 

    L3.BackColor = QBColor(11)

 

End Sub

 

印出星號三角形 

 

Private Sub Form_Activate()

 

    Dim t As Integer

 

    Dim r As Integer

 

   

 

    For t = 1 To 5

 

        For r = 1 To t

 

            Print "*";

 

        Next r

 

        Print

 

    Next t

 

End Sub

 

九九乘法表1  

 


Private Sub Command1_Click()

 

    Dim a As Integer

 

    Dim b As Integer

 

   

 

    For a = 1 To 9

 

        For b = 1 To 9

 

            Print a; "*"; b; "="; a * b,

 

        Next b

 

        Print

 

    Next a

 

End Sub

 

 

Private Sub Form_Load()

 

    Form1.Caption = "九九乘法表1"

 

    Command1.Caption = "印出"

 

End Sub

 

九九乘法表2  

 


    Private Sub Command1_Click()

 

    Dim a As Integer

 

    Dim b As Integer

 

   

 

    For a = 1 To 9

 

        For b = 1 To 3

 

            Print b; "*"; a; "="; a * b,

 

        Next b

 

        Print

 

    Next a

 

   

 

    Print

 

   

 

    For a = 1 To 9

 

        For b = 4 To 6

 

            Print b; "*"; a; "="; a * b,

 

        Next b

&

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