Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer, n As Integer
        Dim s As Single
        n = InputBox("请输入n")
        s = 0
        For i = 1 To n
            s = s + (-1) ^ (i + 1) * (2 * i + 1) / (2 * i)
        Next
        Debug.Print(s)
    End Sub
End Class
