Option Strict On
Module Module1
    'Задача с экзамена на рекурсивное вычисление:
    'Условие: Н0=0,Н1=2*x, Нn=2*x*Hn-1-(n-1)*Hn-2
    'Напечатать таблицу значений при x от -1 до 1, и n=5
    Function fact(ByVal x As Double, ByVal N As Double) As Double
        If N = 0 Then
            Return 0
        ElseIf N = 1 Then
            Return 2 * x
        Else
            Return 2 * x * fact(x, N - 1) - (N - 1) * fact(x, N - 2)
        End If

    End Function
    Sub Main()
        Dim N, x As Double
        N = 5
        Dim Xmax As Double = 1
        Dim Xmin As Double = -1
        Dim dx As Double = 0.1
        For i As Integer = 0 To CInt((Xmax - Xmin) / dx)
            x = Xmin + i * dx
            Console.WriteLine("{0}   {1}", x, fact(x, N))
        Next i

        Console.ReadLine()
    End Sub

End Module
