Difference between revisions of "Fibonacci sequence"
From CompSciWiki
Line 10: | Line 10: | ||
"The 10th number of the fibonacci sequence is X". (where X should be the 10th number.)<br/> | "The 10th number of the fibonacci sequence is X". (where X should be the 10th number.)<br/> | ||
<br/> | <br/> | ||
− | Note that the fibonacci sequence | + | Note that the fibonacci sequence is F(n) = F(n-1) + F(n-2) for n > 1, F(1) = 1, F(0) = 1.<br/> |
− | + | Example: F(5) = 1, 1, 2, 3, 5 | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|SolutionCode=public class Fibonacci | |SolutionCode=public class Fibonacci |
Revision as of 12:40, 1 April 2010
Back to the Program-A-Day homepage
ProblemWrite a complete Java program Fibonacci that:
|
...by students
An image or By Students section | |
---|---|---|
SolutionThe solution... | ||
Code |