Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x, y, g, n, i, sum As Integer
n = CInt(TextBox1.Text)
x = 0
y = 1
TextBox2.Text = ""
TextBox2.Text &= CStr(x) & ","
TextBox2.Text &= CStr(y) & " "
For i = 3 To n
sum = x + y
TextBox2.Text &= ", " & CStr(sum)
x = y
y = sum
y = sum
Next i
End Sub
End Class
No comments:
Post a Comment