C#3.0版的费波纳数算法
1: Func<int, int> fib = null;
2: fib = n => n > 1 ? fib(n - 1) + fib(n - 2) : n;
3:
4: for (int c = 0; c < 10; c++)
5: {
6: Console.WriteLine(String.Format("{0}= {1}", c, fib(c)));
7: }
2: fib = n => n > 1 ? fib(n - 1) + fib(n - 2) : n;
3:
4: for (int c = 0; c < 10; c++)
5: {
6: Console.WriteLine(String.Format("{0}= {1}", c, fib(c)));
7: }