要求用控制台应用程序写出如下1,1,2,3,5,8,13,21,34,55,89...
当时没想开,今天调试一下出来了结果
如下
class Program { static void Main(string[] args) { Num(0, 1,1, 30); Console.ReadLine(); } private static int Num(int num, int s, int level, int count) { Console.Write("{0},", s); if (level < count) { num = Num(s, (s + num), ++level, count); } return num; } }