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 denomsum As Double = 0
        Dim denom As Double = denomsum
        Dim numsum As Double = 0
        Dim num As Double = numsum
        Dim v As Integer = 0
        Dim E As Double
        For j As Integer = 0 To 2
            Console.WriteLine()
            Console.WriteLine("Т      |             Fv          |    <Ev>/h (см-1)")
            Console.WriteLine("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _")
            For i As Integer = 0 To CInt((Tmax - Tmin) / dT)
                T = Tmin + i * dT
                v = 0

                denom = denomsum

                num = numsum
                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()
        Console.Clear()
    End Sub


End Module
