Monday, 4 April 2016

Lab 4:Write a Visual Basic Program to Find Fibonacci Series

Private Sub Command1_Click()

Dim i As Integer
Dim n As Integer
Dim fib(15) As Integer
n = Val(Text1.Text)
fib(0) = 0
fib(1) = 1
For i = 2 To n - 1
fib(i) = fib(i - 1) + fib(i - 2)
Next i
For i = 0 To n - 1
Print fib(i)
Next i
End Sub

No comments:

Post a Comment