id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

fibonacci


The fibonacci sequence is: 1, 1, 2, 3, 5, 8, 13, 21, and so on, where the first two numbers are 1 and 1, and then each of the remaining numbers is computed by adding the previous two numbers. For example, the 8th fibonacci number is 21 because it is the sum of 8 and 13. Implement a method that returns the nth fibonacci number.


fibonacci(1) → 1
fibonacci(2) → 1
fibonacci(5) → 5

...Save, Compile, Run (ctrl-enter)

int fibonacci(int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy