how calculate this method Fn = Fn-1 + Fn-2

myaspnet used Ask the Experts™
how calc  Recursion method that takes an integer value and returns the summation of all numbers
Fn = Fn-1 + Fn-2
For example: F(10) = 0,1,1,2,3,5,8,13,21,34
Summation = 88
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
static void Main(string[] args)
           int input;
           System.Console.Write("Enter Number please : ");
            input = int.Parse(System.Console.ReadLine());
            int R=fibonacci(input)-1;
        public static int fibonacci(int N)
            if (N < 2)
                return 1;
            int Result;
            Result = fibonacci(N - 1) + fibonacci(N - 2);
            return Result;
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

I see that you made a new question for your homework problem. You do realize it is not permissible for us to do your homework for you, right?

Since you apparently don't understand what recursion is, why don't you ask that instead of asking us to do your work for you?



Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial