Fibonacci


Goal:

Print out the first 12 numbers of the fibonacci sequence.

Steps:

  1. There is more than one way to code a solution to this. The following steps give you some guidelines for one of them.
  2. Declare and initialize three int variables: number1, number2, and sum.
  3. Initialize number1 and number2 to the first two numbers of the fibonacci sequence (0 and 1) and print both numbers.
  4. Use a for loop that calculates the sum of the two numbers and prints it. The for loop should repeat 10 times.
  5. Now try to figure out how to change the variables before the for loop repeats so the sequence of numbers is correct.