title: fibonacci series - recursive summation
body: <p>Ok, I initially wrote a simple code to return the Fibonacci number from the series based on the user input..</p>
  
  <p>n=5 will produce 3..</p>
  
  <pre><code>static int fibonacci(int n) {
          if (n == 1)
              return 0;
          else if (n == 2)
              return 1;
          else
              return (fibonacci(n - 1) + fibonacci(n - 2));
      }
  </code></pre>
  
  <p>I was thinking of modifying the code to return the sum of the series rather than just returning the value from the series and while trying to do the sum I accidentally added 1 to the return statement and to my surprise, it returned the sum correctly. </p>
  
  <p>The below code will return 7 for n=5.</p>
  
  <p>I am not sure if this is a right way to calculate the sum...</p>
  
  <p>I still couldn't figure out how the summation of the series works if I add 1. Can someone please explain?? </p>
  
  <pre><code>static int fibonacci(int n) {
      if (n == 1)
          return 0;
      else if (n == 2)
          return 1;
      else
          return (fibonacci(n - 1) + fibonacci(n - 2)+(1));
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>For Fibonacci series..0,1,1,2,3,5,8,13,21,34,55,89,144....</p>
  
  <p>I tried for some random n</p>
  
  <p>n=13</p>
  
  <p>The function returns 376</p>
  
  <p>0+1+1+2+3+5+8+13+21+34+55+89+144 = 376 </p>
  
  <p>n=10</p>
  
  <p>The function returns 88</p>
  
  <p>0+1+1+2+3+5+8+13+21+34= 88</p>