Create a program to generate the first 20 Fibonacci numbers. This time use a counter to control the number of iterations. Add a Picture Box to print your results to. Make sure the PictureBox.Font Transparent = False, AutoRedraw = True and that the BackColor is different from the ForeColor. Use the following code to help you.
Dim FibNumber As Integer,FibNext As Integer,Counter As Integer
FibNumber=0
FibNext=1
Picture1 Print "Ist20FibonacciNumbers"
Do While Counter<20
Picture1 Print FibNumber&","
Picture1 Print FibNext&","
FibNumber=FibNumber+FibNext
FibNext=FibNext+FibNumber
Counter=Counter+2
If Counter=10 Then
Picture1 Print
‘Thiscreatesanewline
EndIf
Loop
Write an IPO chart and the algorithm in pseudocode and as a flowchart.
No comments:
Post a Comment