Double factorial

Report a typo

Implement a function to compute the double factorial. It is the product of natural numbers of the same parity, not exceeding a given number.

For example:
7!!=7⋅5⋅3⋅1
8!!=8⋅6⋅4⋅2

The function argument can be any non-negative integer.

Use BigInteger to solve the problem.

Sample Input 1:

7

Sample Output 1:

105
Write a program in Java 17
import java.math.BigInteger;

class DoubleFactorial {
public static BigInteger calcDoubleFactorial(int n) {
// type your java code here
}
}
___

Create a free account to access the full topic