一、阶乘

  public int aa(int a)
        {
            if (a == 0)
            {
                return 1;
            }
            else
            {
                return a * aa(a - 1);
            }
        }

二、斐波那契数列

   private static int Fib(int v)
        {
            if (v == 1 || v == 2)
                return 1;
            else
                return Fib(v - 1) + Fib(v - 2);
        }

自己调用自己!!!

 posted on 2018-03-16 09:24  絆τ  阅读(178)  评论(0编辑  收藏  举报