Option Explicit On
Module Module1

    Sub Main()
        Console.WriteLine("введите число экспериментальных точек")
        Dim N As Integer = Integer.Parse(Console.ReadLine())
        Dim X(N - 1), Y(N - 1) As Double
        For i As Integer = 0 To N - 1
            Console.WriteLine("введите пару значений х и у №{0} через точку с запятой", i + 1)
            Dim line As String = Console.ReadLine()
            Dim semicolon As Integer = line.IndexOf(";")
            X(i) = line.Substring(0, semicolon)
            Y(i) = line.Substring(semicolon + 1)
        Next i
        Dim Xmean, Ymean As Double
        For i As Integer = 0 To N - 1
            Xmean = Xmean + X(i)
            Ymean = Ymean + Y(i)
        Next i
        Xmean = Xmean / N
        Ymean = Ymean / N
        Dim nominator, denominator As Double
        For i As Integer = 0 To N - 1
            nominator = nominator + (X(i) - Xmean) * (Y(i) - Ymean)
            denominator = denominator + (X(i) - Xmean) ^ 2
        Next i
        Dim a As Double = nominator / denominator
        Dim b As Double = Ymean - a * Xmean
        Console.WriteLine("параметры аппроксимирующего уравнения y = a*x + b :")
        Console.WriteLine("a = {0} b = {1}", a, b)
        Console.ReadLine()
    End Sub

End Module
