On Planet Linear Chaos, infants are expected to find the factorial of two-digit numbers. Well, we'll behave like adults, like programmers, and write a method that calculates factorials up to the entered number.
Factorial
- 8
Locked
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Jonaskinny Java Developer at Sandmedia
10 March 2022, 03:38
Actually its BigDecimal (see import statement) and it wont let you do dec = new BigDecimal(dec.intValue() * x);
0
Thành Black
26 September 2021, 02:06
What. I don't know it before.
0
Petros
11 August 2020, 19:45
Use BigInteger. They won't let you display a number to the e such as: 5.7133839564458505E262. Nope, it's gotta be the WHOLE number, all the digits. That's where BigInteger comes in.
+7
Devonte A
14 July 2020, 08:59
Remember that the int/long types will not be able to store the factorial of large numbers :)
+1