1 namespace demo
 2 {
 3     public class Program
 4     {
 5         static void Main(string[] args)
 6         {
 7             int res = Sum(100);
 8         }        
 9         static int Sum(int n)
10         {
11             if (n <= 1)
12                 return n;
13             return n+Sum(n - 1);
14         }
15     }
16 }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-10-31
  • 2021-07-27
  • 2022-12-23
猜你喜欢
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-03-05
相关资源
相似解决方案