0

The program doesn't accept big numbers, so i tried using BigInteger, it didn't go well.....i hope someone can put me through.

https://code.sololearn.com/cEjLe2fhm8kz/?ref=app

24th Sep 2018, 3:15 PM
Illegal
Illegal - avatar
3 Antworten
0
This worked for me, to get a number loaded at least: BigInteger bi = new BigInteger("12345");
24th Sep 2018, 4:26 PM
Kirk Schafer
Kirk Schafer - avatar
0
but that only works with values.........i'm trying to store the factorial in a variable and use the variable as the argument. but i'm having errors
24th Sep 2018, 5:29 PM
Illegal
Illegal - avatar
0
You have to work all in BigIntegers. Where you have: factorial *= i I believe you need to do this: factorial = factorial.multiply(new BigInteger(...)) Your new BigInteger is constructed as indicated before, with a string: Integer.toString(i) Making: factorial = factorial.multiply(new BigInteger(Integer.toString(i))); Here's a site with usage examples for the BigInteger class: http://javatutorialhq.com/java/math/biginteger-class/
24th Sep 2018, 6:43 PM
Kirk Schafer
Kirk Schafer - avatar