Option Strict On

Module Module1

    Sub Main()
        Const h As Double = 0.0000000000000001986
        Const k As Double = 0.0000000000000001381
        Const eps As Double = 0.000001
        Dim T As Double
        Dim O(2) As Double
        O(0) = 10
        O(1) = 100
        O(2) = 1000
        Dim Tmin As Double = 100
        Dim Tmax As Double = 2000
        Dim dT As Double = 100
        Dim v As Integer = 0
        Dim E As Double
        For j As Integer = 0 To 2
            Console.WriteLine()
            Console.WriteLine(" T   |      Fv          |<Ev>/h  (см-1)")
            Console.WriteLine("---------------------------------------------------")
            For I As Integer = 0 To CInt((Tmax - Tmin) / dT)
                T = Tmin + I * dT
                v = 0
                denom = 0
                num = 0
                Do
                    denomsum = Math.Exp((-v - 0.5) * h * O(j) / k / T)
                    denom = denom + denomsum
                    numsum = (v + 0.5) * h * O(j) * Math.Exp((-v - 0.5) * h * O(j) / k / T)
                    num = num + numsum
                    v = v + 1
                Loop Until denomsum < eps
                E = num / denom
                Console.WriteLine("{0,-4}  |  {1,-9:F4}  |  {2:E}", T, (denom), E / h)
            Next I
            Console.ReadLine()
        Next j
        Console.ReadLine()

    End Sub

End Module
