//一对幼兔,1个月后长成小兔, //再过一个月长成成兔并且生下一对幼兔, //问,24个月后,有多少对兔子。 while (true) { int m, ct, xt, yt, zt; Console.Write("请输入月份:"); m = int.Parse(Console.ReadLine()); ct = 0; xt = 0; yt = 1; zt = 1; for (int i = 1; i <= m; i++) { if (i == 1) { ct = 0; xt = 0; yt = 1; zt = 1; } else { ct = ct + xt; xt = yt; yt = ct; zt = ct + xt + yt; } } Console.WriteLine(ct); Console.WriteLine(xt); Console.WriteLine(yt); Console.WriteLine(zt); }