So I need to write a program that will approximate PHI (the golden ratio) using Fibonacci Numbers. It has to be within a negative power of 10 (between -1 and -16) oh PHI. So for example, if I put -2 into the input, the approximation of PHI would have to be with 10^-2 of the number that we’re using of 1.618033988749895. Also, we need to show how many Fibonacci terms that were used to get to that number and the difference that the number that we approximated is to PHI.

Here’s my code so far. Please help haha! I think that my problem is in the loop, because when I debug, the program doesn't even give me an answer.

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim Accuracy As Integer

Dim StrOut As String

Dim A, B, Sum, PHI, Difference, Count As Decimal

Accuracy = CInt(txtAccuracy.Text)

A = 0

B = 1

Count = 0

Do

Sum = A + B

A = B

B = Sum

PHI = Sum / A

Difference = 1.6180339887498949 - PHI

Count = Count + 1

If Difference <= 10 ^ Accuracy Then

Exit Do

End If

Loop Until Difference <= 10 ^ Accuracy

StrOut = vbTab & "Number of Terms Used:" & vbTab & CStr(Count) & vbCrLf & vbTab & "Approximation of PHI:" & vbTab & CStr(PHI) & vbCrLf & vbTab & "Difference from PHI:" & vbTab & CStr(Difference)

StrOut = txtAnswer.Text

End Sub

End Class