Tinh tong chan le

Private Sub Command1_Click()

A = Val(T1.Text)

b = Val(T2.Text)

Dim t, tc, tl As Integer

tc = 0

tl = 0

t = 0

On Error GoTo loi:

For i = A To b

    If i Mod 2 = 0 Then

        s1 = s1 & i & ","

        tc = tc + i

        Else

        S2 = S2 & i & ","

        tl = tl + i

        End If

        t = t + i

        Next

        s1 = Mid(s1, 1, Len(s1) - 1)

        S2 = Mid(S2, 1, Len(S2) - 1)

        T3.Text = s1

        T4.Text = S2

        T5.Text = tc

        T6.Text = tl

        T7.Text = t

        Exit Sub

loi:

        MsgBox ("Soá ñaàu phaûi nhoû hôn soá cuoái")

        Exit Sub

End Sub

Private Sub Command2_Click()

T1 = ""

T2 = ""

T3 = ""

T4 = ""

T5 = ""

T6 = ""

T7 = ""

T1.SetFocus

End Sub

Private Sub Command3_Click()

If MsgBox("Baïn muoán thoaùt khoâng", vbYesNo + 32 + vbDefaultButton1, "Thoâng Baùo") = vbYes Then

End

End If

End Sub

Bạn đang đọc truyện trên: AzTruyen.Top

Tags: