for (int j = 0; J <, J + +)
{
Rabbit problem; Enter the number of months, output into rabbits, bunnies, young rabbits, and the total logarithm of rabbits
int x=0, y=0, z=1,t=1;//x,y,z are the logarithm of rabbits, rabbits and young rabbits respectively; t is the total logarithm
Console.WriteLine ("Please enter the number of months:");
int m = Convert.ToInt32 (Console.ReadLine ());
for (int i = 0; i < m; i++)
{
if (i>0)
{
x = x + y;//this month into rabbit = last month's Rabbit + last month's Bunny
y = z;//Rabbit of the month = last month's Baby Bunny
z = x;//this month's baby rabbit = this month's rabbit
}
}
t = x+y+z;//Total rabbit logarithm
Console.WriteLine (m+ "Months later, a total of" +t+ "to rabbits;);
Console.WriteLine (x + "pairs into rabbits;");
Console.WriteLine (y + "pair of bunnies;");
Console.WriteLine (z + "pairs of young rabbits;");
Console.readkey ();
}
C # Bunny Problem