Results 1 to 2 of 2

Thread: Arrays!!!! Help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Location
    Illinois
    Posts
    27

    Unhappy

    I need help writing a code that generates the first ten Fibonocci (not sure I spelled this word correctly), put them in an array and print it out the calculating has to start at the 3rd number. example 1 1 2 3 5
    I'm a MICKEY FAN

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    Place a command button on your form and put the following code behind it:
    Code:
    Private Sub Command1_Click()
    
    Dim arrNums(1 To 10) As Integer
    Dim intX As Integer
    
    arrNums(1) = 1
    arrNums(2) = 1
    arrNums(3) = 2
    For intX = 4 To 10
        arrNums(intX) = arrNums(intX - 1) + arrNums(intX - 2)
    Next
    
    ' print the numbers directly onto the form:
    For intX = 1 To 10
        Print arrNums(intX)
    Next
    
    End Sub
    "It's cold gin time again ..."

    Check out my website here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width