Difference between revisions of "Fibonacci Numbers"

From CompSciWiki
Jump to: navigation, search
Line 4: Line 4:
  
  
 +
|SideSectionTitle=Introducing Arrays
 
|SideSection=
 
|SideSection=
 
[[Image:Wiki_array01.jpg|float|267px]]
 
[[Image:Wiki_array01.jpg|float|267px]]

Revision as of 12:36, 6 April 2010

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

float
Taken from http://www.flickr.com/photos/daniello/565304023/

An image or By Students section

Solution

The solution...

Code

Solution Code

Back to the Program-A-Day homepage