using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int a = 0;//成兔 int b = 0;//小兔 int c = 1;//幼兔 for (int mouth = 2; mouth <= 24;mouth++ ) { a = a + b; b = c; c = a; Console.WriteLine("第{0}个月成兔:{1}小兔:{2}幼兔:{3}",mouth,a,b,c); } Console.WriteLine(a); Console.WriteLine(b); Console.WriteLine(c); Console.ReadLine(); } } }
时间: 2024-11-07 06:41:59