[go: up one dir, main page]

0% found this document useful (0 votes)
62 views2 pages

Fibonacci Series

The document contains code for 3 click event procedures that generate Fibonacci series. The FOR_Click procedure uses a For loop, DOWHILE_Click uses a Do While loop, and DOUNTILL_Click uses a Do Until loop to iterate from 1 to the number of terms input by the user. Each loop calculates the next term in the Fibonacci series and prints it to the Picture box.

Uploaded by

Siri PSG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views2 pages

Fibonacci Series

The document contains code for 3 click event procedures that generate Fibonacci series. The FOR_Click procedure uses a For loop, DOWHILE_Click uses a Do While loop, and DOUNTILL_Click uses a Do Until loop to iterate from 1 to the number of terms input by the user. Each loop calculates the next term in the Fibonacci series and prints it to the Picture box.

Uploaded by

Siri PSG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Private Sub FOR_Click()

Dim a, b, c, series As Integer


Picture1.Cls
series = InputBox("Enter number of series")
a=1
For x = 1 To series
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 DOWHILE_Click()


Dim a, b, c, series As Integer
Picture1.Cls
series = InputBox("Enter number of series")
a=1
Do While x < series
If x > 1 Then
c=a+b
a=b
b=c
Picture1.Print c & Space(2);
Else
Picture1.Print a & Space(2);
b=a
End If
x=x+1
Loop
End Sub

Private Sub DOUNTILL_Click()


Dim a, b, c, series As Integer
Picture1.Cls
series = InputBox("Enter number of series")
a=1
Do Until x > series - 1
If x > 1 Then
c=a+b
a=b
b=c
Picture1.Print c & Space(2);
Else
Picture1.Print a & Space(2);
b=a
End If
x=x+1
Loop
End Sub

You might also like