0
Programming
To implement N-Fibonacci number
1 Answer
+ 1
Using recursion could be the easiest
Example in c#:
int FibR(int n)
{
if(n ==0) return 0;
if(n ==1) return 1;
return FibR(n-2) +FibR(n-1);
}
If you want it to start counting at one just use one if
if(n ==0 || n ==1) return 1;
And they you can just write that method and give it a number or use a for loop if you want the whole sequence