Write a method called fact that recursively calculates the factorial value of its single int parameter. The value returned by fact is a long.
LANGUAGE: JAVA
CHALLENGE:
Write a method called fact that recursively calculates the factorial value of its single int parameter. The value returned by fact is a long.
SOLUTION:
public long fact(int n) { if (n <= 1){ return 1; }else{ return (fact(n-1) * (long) n); } }