University of Calgary

Compute Fibonacci Number

Compute Fibonacci Number

 source: Tino Duong, 2003

Description:

The Fibonacci sequence is a special number progression where the Nth number can be defined by the two previous numbers in the sequence. Therefore, if we denote the nth term by fn, then by the definition fn = fn-2 + fn-1. The 0th term is accepted as 1. By our rule one can produce all the terms in the sequence. . The first few Fibonacci numbers are 1, 1, 2, 3, 5, 8, 13, 21, ...

Your job is to write a program that will compute the Nth number in the Fibonacci sequence.

Requirements:

    The output should look similar to this:

    This program will enter the Nth number of the Fibonacci sequence
    Enter the Nth number now
    9
    Done iteratively, the value is : 34
    Done recursively, the value is : 34

 Written Section:

Additional Requirements:

Concepts:

Additional Concepts:



Updated: August 29, 2005 12:13 AM