Option Strict On
Module Module1
    Function f(ByVal x As Double, ByVal k As Double) As Double
        Return Math.Exp((x ^ 2) / 2) * x ^ k
    End Function
    Sub Main()
        Dim a As Double = 0
        Dim b As Double = 1
        Dim k, x As Double
        Dim kmax As Double = 8
        Dim kmin As Double = 0
        Dim dk As Double = 1
        Dim dx As Double = 0.001
        Dim int As Double
        For i As Integer = 0 To CInt((kmax - kmin) / dk)
            k = kmin + i * dk
            int = 0
            For j As Integer = 1 To CInt((b - a) / dx - 1)
                int = int + f(a + j * dx, k)
            Next j
            int = dx * ((f(a, k) + f(b, k)) / 2 + int)
            Console.WriteLine("{0}    {1:f4}", k, int)
        Next i
        Console.ReadLine()
    End Sub

End Module
