Find the numbers N!



  • I found the factory. 2.6525285981219103E32♪ Problem is E32. In the future, the accuracy is lost and the error is accumulated. How to convert the number that would not be E



  • If values are not included in the long or int range, BigInteger or BigDecimal should be used. Your task will be to:

     private static BigInteger factorial(long number) {
        BigInteger result = BigInteger.ONE;
        for (long i = 1; i <= number; i++)
            result = result.multiply(BigInteger.valueOf(i));
    
    return result;
    

    }




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2