Results 1 to 13 of 13

Thread: Fibonacci program drives me nuts

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2008
    Posts
    24

    Fibonacci program drives me nuts

    I don't wanna look like [I'm lazy] and just asking to do a program for me, but I have been trying to figure it out for a total of 4 hours. The exact requirements are:
    Code:
    2) 	Write a program that will calculate the Fibonaci sequence up to a given element.  Write a program that will allow the user to enter the 10, and the 34 will be calculated.  Remember the Fibonaci sequence is generated by giving yourself the first two values, 0 and 1, and then adding the two previous values to get the next value.
    		0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 
    
    For example:
    
    Fibo(3) = Fibo(1) + Fibo(2) = 0 + 1 = 1
    Fibo(4) = Fibo(2) + Fibo(1) = 1 + 1 = 2
    Fibo(5) = Fibo(3) + Fibo(4) = 1 + 2 = 3
    Etc.
    
    Hint:  You will need to preserve the TWO previous values in variables, not just the ONE previous value like we have done with all the rest of the loops.
    Just throw suggestions out there. By the way, I use vb 6.0
    Last edited by MartinLiss; Apr 10th, 2008 at 01:57 PM.

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