Option Strict On
Imports System.IO
Module Module1
    Function f(ByVal x As Double) As Double
        Return -(1 - Math.Exp(-x)) * Math.Exp(-x)
    End Function
    Sub Main()
        Dim output As StreamWriter = New StreamWriter("output.txt")
        Dim t, t0, tk, h, x0, x, u0, u As Double
        t0 = 0
        tk = 0.01
        h = 0.001
        x0 = 2
        u0 = 0
        output.WriteLine("{0};{1};{2}", t0, x0, u0)
        For i As Integer = 0 To CInt((tk - t0) / h - 1)
            t = t0 + i * h
            x = x0 + h * u0
            u = u0 + h * f(x)
            x0 = x
            u0 = u
            output.WriteLine("{0};{1};{2}", t, x, u)
            Console.WriteLine("{0}   {1}   {2}", t, x, u)
        Next i
        output.Close()
        Console.ReadLine()
    End Sub
End Module
