Saturday, September 2, 2017

Fibonacci Numbers in Visual Basic 6

A very simple program that I wrote using Microsoft Visual Basic 6 to accept a number from our user and generate a series of Fibonacci Numbers based on the given number by our user. The code is very simple and easy to understand.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

'Fibonacci Numbers in Visual Basic 6
'Date : September 2, 2017
' Written By: Mr. Jake R. Pomperada, MAED-IT
' Mandaluyong City, Metro Manila Philippines


Private Sub Command1_Click()
Dim a, b, c, input_values As Integer
Picture1.Cls
input_values = Val(Text1.Text)
a = 1
For x = 1 To input_values
    If x > 2 Then
        c = a + b
        a = b
        b = c
        Picture1.Print c & Space(2);
    Else
        Picture1.Print a & Space(2);
        b = a
    End If
Next x
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Picture1.Cls
Text1.SetFocus
End Sub

Private Sub Command3_Click()
End
End Sub



No comments:

Post a Comment