每天知道多一点
To learn more everyday!
1:RegularExpressions
2:Fibonacci数列
1+1+2+3+5+8+......使用递归算法计算第N个数的值
1using System;
2 class demo
3 {
4 public static int fibo(int i)
5 {
6 if(i<3)
7 return 1;
8 if(i<0)
9 return 0;
10 else
11 return fibo(i-2)+fibo(i-1);
12 }
13 static void Main()
14 {
15 Console.WriteLine(fibo(30));
16 }
17 }
18
19
2 class demo
3 {
4 public static int fibo(int i)
5 {
6 if(i<3)
7 return 1;
8 if(i<0)
9 return 0;
10 else
11 return fibo(i-2)+fibo(i-1);
12 }
13 static void Main()
14 {
15 Console.WriteLine(fibo(30));
16 }
17 }
18
19