C#用递归方式求阶乘

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 弟子规
{
    class Program
    {
        public static double recursion(int n)
        {
                return (n==1?1:n * recursion(n - 1));
        }
        static void Main(string[] args)
        {
            Console.Write(recursion(6));
        }
    }
}
(假设n为正整数)

相关文章:

  • 2021-06-05
  • 2021-12-10
  • 2021-10-18
  • 2022-01-18
  • 2022-02-21
  • 2021-11-18
猜你喜欢
  • 2021-12-07
  • 2021-11-17
  • 2021-12-06
  • 2021-08-20
  • 2022-12-23
  • 2021-11-17
  • 2021-08-01
相关资源
相似解决方案