Option Strict On
Module Module1
    Function f(ByVal s As Double, ByVal r As Double) As Double
        Return Math.Exp(-0.0076 * s ^ 2) * Math.Sin(2.67 * s - 0.00004 * s ^ 3) * Math.Sin(s * r) / s / r / s
    End Function
    Sub Main()
        Dim a As Double = 0
        Dim b As Double = 30
        Dim rmin As Double = 2.2
        Dim r As Double
        Dim rmax As Double = 3
        Dim dr As Double = 0.05
        Console.WriteLine(" Введите число элементарных отрезков")
        Dim n As Integer = Integer.Parse(Console.ReadLine())
        Dim h As Double = (b - a) / n
        Console.WriteLine()
        Console.WriteLine("    r           P(r)")
        Console.WriteLine(" -----------------------------")
        Dim p As Double
        Dim psum As Double
        For i As Integer = 0 To CInt((rmax - rmin) / dr)
            r = rmin + i * dr
            p = h * (f(b, r) + f((a + Double.Epsilon), r)) / 2
            psum = 0
            For j As Integer = 1 To n - 1
                psum = h * f((a + h * j), r)
                p = p + psum
            Next j
            Console.WriteLine("    {0:f2}       {1:f5}", r, p)
        Next i
        Console.ReadLine()
    End Sub

End Module
