Project 2: Java Programming
Fibonacci Numbers: Using the above program as a model,
generate and print the first N Fibonacci Numbers.
The Fibonacci Numbers is the sequence of integers: 1, 1, 2, 3,
5, 8, etc, where each number in the sequence is the sum of
the previous two numbers in the sequence.
One method to generate the Fibonacci numbers is as follows:
- Set oldFibonacci to 0, thisFibonacci to 1, index to 0.
- Set newFibonacci to the sum of thisFibonacci and oldFibonacci.
- print out thisFibonacci, move thisFibonacci to oldFibonacci
then move newFibonacci to thisFibonacci.
- Increment count, and if it is less than N, return to step 2.
Copyright 1998 Burton Rosenberg; All rights reserved.