Jump to content

Fibonacci numbers/Program/Exercise

From Wikiversity

Write a computer-program (in pseudocode) that prints the sequence of the Fibonacci numbers (so f1=1,f2=1,f3=2,f4=3,f5=5,f6=8,f7=13,...).

    • The computer has as many memory units as needed, which can contain natural numbers.
    • It can write the content of a memory unit into another memory unit.
    • It can add the content of two memory units and write the result into another memory unit.
    • It can print contents of memory units and it can print given texts.
    • There is a stop command.

The initial configuration is

(1,0,0,0,0,0,0,…).

The program runs without stopping and prints "the n-th Fibonacci number is fn.“