Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Anonymous-recursion/C-sharp/anonymous-recursion.cs
Normal file
8
Task/Anonymous-recursion/C-sharp/anonymous-recursion.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
static int Fib(int n)
|
||||
{
|
||||
if (n < 0) throw new ArgumentException("Must be non negativ", "n");
|
||||
|
||||
Func<int, int> fib = null; // Must be known, before we can assign recursively to it.
|
||||
fib = p => p > 1 ? fib(p - 2) + fib(p - 1) : p;
|
||||
return fib(n);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue