1+2+3+...+n 递归

public class Sum {

  public static int count(int n) {

    if(n=1)

      return 1;

    if (n > 1) {
      return count(n - 1) + n;
    } 
  }

}

posted @ 2021-06-22 23:34  hippoppower  阅读(478)  评论(0)    收藏  举报