Fibonacci Numbers

From CompSciWiki
Revision as of 12:47, 6 April 2010 by JustinS (Talk | contribs)

Jump to: navigation, search

Back to the Program-A-Day homepage

Problem

This problem involves you writing a program that will take in which Fibonacci number you want to print out and then iteratively calculates the number. Remember that the algorithm for Fibonacci numbers is Fibonacci[n] = Fibonacci[n-1] + Fibonacci[n-2] where Fibonacci[0] = 0 and Fibonacci[1] = 1. Remember you are going to want to declare your array but not specify the size until you take in your input with JOptionPane. Print out the number that is specified.

 

Introducing Arrays

Wiki array01.jpg

Solution

The solution...

Code

Solution Code

Back to the Program-A-Day homepage