My code:
package big;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
System.out.println (factorial (5));
}
public static int factorial (int n) {
int f = 1;
for (int i = 1; i <= n; i++) {
f = f * i;
}
return f;
}
}
How do I add two new variable nBig and fBig that convert x and n to BigInteger. Also how do i modify the return value for the pow method to BigInteger which means changing the type for the i variable too. Finally, how to rewrite those math operations using BigInteger operations.