This program was written to turn our attentionto the idea of fibonacci sequences. This program illustratesthat a recursive routine may call itself a number of timeswith different arguments. In fact, as long as a recursiveroutine uses only local variables, the programmer can usethe routine just as he uses any other and assume that itperforms its function and produces the desired value. Youneed not worry about the underlying stacking mechanism.

RECURSION stack operation for fibonacci function :

N X Y Pass

6 * *---------------- 1

5 * * 6 * *---------------- 2

4 * * 5 * * 6 * *---------------- 3

3 * * 4 * * 5 * * 6 * *---------------- 4

2 * * 3 * * 4 * * 5 * * 6 * *---------------- 5

1 * * 2 * * 3 * * 4 * * 5 * * 6 * *---------------- 6

2 1 * 3 * * 4 * * 5 * * 6 * *---------------- 7

0 * * 2 1 * 3 * * 4 * * 5 * * 6 * *---------------- 8

0 * * 2 1 * 3 * * 4 * * 5 * * 6 * *---------------- 9

2 1 0 3 * * 4 * * 5 * * 6 * *---------------- 10

3 1 * 4 * * 5 * * 6 * *---------------- 11

1 * * 3 1 * 4 * * 5 * * 6 * *---------------- 12

3 1 1 4 * * 5 * * 6 * *---------------- 13

4 2 * 5 * * 6 * *---------------- 14

2 * * 4 2 * 5 * * 6 * *---------------- 15

1 * * 2 * * 4 2 * 5 * * 6 * *---------------- 16

0 * * 2 1 * 4 2 * 5 * * 6 * *---------------- 17

2 1 0 4 2 * 5 * * 6 * *---------------- 18

4 2 1 5 * * 6 * *---------------- 19

5 3 * 6 * *---------------- 20

3 * * 5 3 * 6 * *---------------- 21

The rest of the stack operation is left for youto finish as an excercise.