码迷,mamicode.com
首页 > 其他好文 > 详细

兔子生兔子

时间:2015-06-18 17:13:27      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:

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();
        }
    }
}

 

兔子生兔子

标签:

原文地址:http://www.cnblogs.com/qixinjian/p/4586115.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!