Thread: Java Help

Results 1 to 1 of 1
  1. #1 Java Help 
    Senior Member I Modded My PSP psp23's Avatar
    Join Date
    Feb 2007
    Posts
    252
    Hello,

    I'm practicing java for fun, and I came across this problem I can't solve. Can anyone who knows java help me out on this? I'm practicing as much as I can for the AP computer science exam in may. ok here goes:

    The fibonacci sequence is a famous bit of mathematics, and it happens to have a recursive definition. The first two values in the sequence are 0 and 1 (essentially 2 base cases). Each subsequent value is the sum of the previous two values, so the whole sequence is: 0, 1, 1, 2, 3, 5, 8, 13, 21 and so on. Define a recursive fibonacci(n) method that returns the nth fibonacci number, with n=0 representing the start of the sequence.
    fibonacci(0) → 0
    fibonacci(1) → 1
    fibonacci(2) → 1


    The problem is from JavaBat, a really cool site for people like me who are starting Java. I know what the Fibonacci sequence is, but I have no clue on how to translate it into code and follow the recursive requirement.

    I know the answer is somewhere online, but I need someone to explain the process in understandable terms.
    Last edited by psp23; 11-25-2007 at 01:59 AM.
    Reply With Quote  
     

Similar Threads

  1. java
    By ILoveFrenchFries in forum PSP Discussion
    Replies: 6
    Last Post: 05-25-2009, 01:21 AM
  2. psp java
    By robby10ant in forum PSP Homebrew
    Replies: 4
    Last Post: 07-28-2008, 01:29 PM
  3. Java
    By MOOSE#51 in forum Linux
    Replies: 6
    Last Post: 04-29-2008, 02:19 PM
  4. Java
    By ZX83 in forum PSP Software, Firmware & Plugins
    Replies: 4
    Last Post: 11-09-2007, 07:41 PM
  5. Java help, if possible
    By kapital_killa in forum Technical Discussion
    Replies: 1
    Last Post: 09-06-2007, 03:00 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •