Gotta love factorials

This is a method in Java that returns the factorial of the Integer n:

public Double factorial(Integer n){
    if(n == 0) return 1;
    Integer c = n;
        n *= c;
    return n;

This is pretty big. We may want to reduce the number of lines. What's the minimum number of lines you can write this method's body, without changing its signature and returning exactly the same result?


Problem Loading...

Note Loading...

Set Loading...