c++
求1+2+3+...+n
http://www.nowcoder.com/questionTerminal/7a0da8fc483247ff8800059e12d7caf1
class Solution { public: int Sum_Solution(int n) { int sum = n; sum && (sum+=Sum_Solution(n-1)); return sum; } };
求1+2+3+...+n
http://www.nowcoder.com/questionTerminal/7a0da8fc483247ff8800059e12d7caf1
class Solution { public: int Sum_Solution(int n) { int sum = n; sum && (sum+=Sum_Solution(n-1)); return sum; } };
相关推荐