简单方法去理解递归

1递增5次,用递归的方式实现

response.write(sum(0,1));

protected int sum(int t, int value)
    {
        int h;       
        for (h = t; h < 5; )
        {
            h++;
            value++;           
            sum(h, value);
        }
        return value;
    }

posted @ 2012-11-23 14:32  ajunfly  阅读(191)  评论(0编辑  收藏  举报