First page Back Continue Last page Overview Graphics

Exercise

Definition: Every item of the Fibonacci sequence is calculated by its predecessors.

The first eight are:

0, 1, 1, 2, 3, 5, 8, und 13.

Formal Definition: F(n) = F(n-1) + F(n-2), where F(0)=0 and F(1)=1

Exercise:

Write a program to calculate F(n)