Option Strict On
Module Module1
    Function f(ByVal x As Double, ByVal n As Double) As Double
        Return 2 * ((-1) ^ (n + 1)) * Math.Sin(Math.PI * n * x) / n / Math.PI
    End Function
    Sub Main()
        Const eps As Double = 0.001
        Dim xmin As Double = 3.0
        Dim xmax As Double = 5.0
        Dim dx As Double = 0.2
        Dim x As Double
        Dim n As Double = 0
        Dim sum As Double = 0
        For i As Integer = 0 To CInt((xmax - xmin) / dx)
            x = xmin + i * dx
            n = 0
            sum = 0
            Do
                n = n + 1
                sum = sum + f(x, n)
            Loop Until (1 / n) < eps
            Console.WriteLine("{0:F2}     {1}", x, sum)
        Next i
        Console.ReadLine()
    End Sub

End Module
