https://pintia.cn/problem-sets/12/problems/350

 1 int sum(int n)
 2 {
 3     if (n <= 0)
 4     {
 5         return 0;
 6     }
 7     else
 8     {
 9         return n + sum(n - 1);
10     }
11 }

相关文章:

  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
相关资源
相似解决方案