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:

  1. Set oldFibonacci to 0, thisFibonacci to 1, index to 0.
  2. Set newFibonacci to the sum of thisFibonacci and oldFibonacci.
  3. print out thisFibonacci, move thisFibonacci to oldFibonacci then move newFibonacci to thisFibonacci.
  4. Increment count, and if it is less than N, return to step 2.

Copyright 1998 Burton Rosenberg; All rights reserved.