Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub CmdInput1_Click(sender As Object, e As EventArgs) Handles CmdInput1.Click
- Dim n As Long
- Dim i As Long
- Dim tong As ULong
- Dim count As Integer
- Dim ax As String
- tong = 0
- count = 0
- Do While n <= 0
- n = InputBox("Vui lòng nhập vào một số nguyên dương", "Nhập", 0)
- Loop
- For i = 1 To n
- If n Mod i = 0 Then
- tong = tong + i
- Count = Count + 1
- If i Mod 2 = 0 Then
- ax = ax + " " & i
- End If
- End If
- Next
- TxtOut12.Text = "Tổng các ước số: " & tong & vbCrLf & "Số các ước số:" & count & vbCrLf & "Các ước số chẵn : " & ax
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment