递归 斐波那契数列

原文发布时间为:2009-03-01 —— 来源于本人的百度文章 [由搬家工具导入]

using System;
//using System.Collections.Generic;
//using System.Text;

namespace digui1
{
   public class Class1
    {
       public static void Main()
       {
           int n=int.Parse(Console.ReadLine());
           Console.WriteLine("第{0}项为{1}。",n,fun(n).ToString());
           Console.ReadLine();
       }

       public static int fun(int n)
       {
           if (n == 1 || n == 2)
               return 1;
           else
               return fun(n - 1) + fun(n - 2);
       }
    }
}

原文地址:https://www.cnblogs.com/handboy/p/7148507.html