package com.atguigu.exer; public class RecursionTest { public static void main(String[] args){ Recursion recur = new Recursion(); System.out.println(recur.getSum(100)); } } class Recursion{ public int getSum(int n){ if(n == 1){ return 1; }else{ return n + getSum(n - 1); } } }