It's not the sky!
It's the architecture...
Dedicated to the Javaness!
public BigInteger factorial(BigInteger n, BigInteger result) {
if(n.equals(BigInteger.ONE)) {
return result;
} else if(n.compareTo(BigInteger.ONE) > 0){
result = n.multiply(factorial(n.subtract(BigInteger.ONE), result));
} else {
System.out.println("Overflow!!!");
}
return result;
}
No comments:
Post a Comment