Could any one help me? (Fibonacci)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dongatopr
    New Member
    • Oct 2006
    • 1

    Could any one help me? (Fibonacci)

    Could any one help me? (Fibonacci)

    Computing a Fibonacci sequence, with a numericupdown control and display the result on the listview control. This is on visual studio 2005 (VB).

    Please help….
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by dongatopr
    Could any one help me? (Fibonacci)

    Computing a Fibonacci sequence, with a numericupdown control and display the result on the listview control. This is on visual studio 2005 (VB).

    Please help….
    Try this: Fibonacci number program - Wikipedia, the free encyclopedia - see item 16 on the list. (I haven't tried it, just found it.)

    Comment

    • albertw
      Contributor
      • Oct 2006
      • 267

      #3
      hi

      i tried something:

      declare an array first
      Dim longFibonacci(5 0) as Long 'or whatever number

      then have a counter called 'Counter' run on clicking your up/down button

      call a sub

      Public Sub Fibonacci(Count er)
      select case Counter
      case = 0
      Answer =0
      case = 1
      Answer = 1
      case else
      Answer = longFibonacci(i-2) + longFibonacci(i-1)
      End Select
      longFibonacci(C ounter) = Answer
      End Sub

      Comment

      • albertw
        Contributor
        • Oct 2006
        • 267

        #4
        hi again
        seems Long is not long enough :(
        make it
        Dim dblFibonacci(50 ) as Double

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by albertw
          hi again
          seems Long is not long enough :(
          make it
          Dim dblFibonacci(50 ) as Double
          Not long enough? How large a result are we talking about? Perhaps the problem is simply in the type of any intermediate results.

          Comment

          Working...