
Option Strict On
Module Module1
    Function sum(ByVal x As Double, _
                 ByVal p As Double, _
                 ByVal kp As Double) As Double
        Return 256 * p ^ 4 * x ^ 5 * ((1 - x) ^ (-1)) * ((4 * x + 1) ^ (-4)) - 10 ^ kp
    End Function
    Sub Main()
        Dim a As Double = 0
        Dim b As Double = 1
        Dim eps As Double = 0.0000001
        Dim fa, fb, p, kp, r, g As Double
        p = 2
        kp = -2.08
        fa = sum(a, p, kp)
        fb = sum(b, p, kp)
        Do While Math.Abs(b - a) > 2 * eps
            Dim c = (a + b) / 2
            Dim fc = sum(c, p, kp)
            If Math.Sign(fa) <> Math.Sign(fc) Then
                b = c
                fb = fc
            Else
                a = c
                fa = fc
            End If
        Loop
        r = (a + b) / 2
        g = 4 * r + 1
        Console.WriteLine("{0:f2}", r / g * 100)
        Console.ReadLine()
    End Sub
End Module