Wednesday, March 9, 2022

C# Factorial of big integer number

Create a console application.


using System;
using System.Numerics;

namespace BigIntegerConsoleApp
{
    class Program
    {
        public static BigInteger factorial(BigInteger n)
        { 
            if (n==1 || n==0)
            {
                return 1;
            }
            return n * factorial(n - 1);
        }

        static void Main(string[] args)
        {
            BigInteger result = factorial(999);
            Console.WriteLine(result.ToString());
            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment

Hot Topics