I have to find the 6th fibbonacci number in fibbonacci sequence . fib(6) calls fib(4) and fib(5) first fib(5) say . fib(5) calls fib(4) and fib(3) and finally reach base case and fib(2) , fib(3) fib(4) and finally fib(5) is calculated . When fib(5) calculated fib(6) calls fib(4) . This time by same process f(2) f(3) and finally f(4) is calculated . But if we can save value for fiv(4) when fiv(5) is called , we don't need to calculate again when fiv(4)'s called . Instead we can use the saved value for fiv(4) when fiv(5) is called . How can i do that 

[![enter image description here](https://i.stack.imgur.com/sRZDE.png)](https://i.stack.imgur.com/sRZDE.png)

```
int fib(int n)
{
    if(n==0)
         return 0;
    else if(n==1)
            return 1;
    return fib(n-1)+fib(n-2);
}

```