class Solution { public: int getSum(int n) { int sum=n; n>0&&(sum+=getSum(n-1)); //不用放入if语句当中,因为在&&两边,所以后面要加一个括号 return sum; } };