Facto sum problem in hackerblock

how to store value in big integer

//Facto Sum-hackerblocks

import java.util.*;
import java.math.BigInteger;
public class Main {

static BigInteger fact(int n){
	BigInteger b= new BigInteger("1");
	for(int i=2;i<=n;i++){
		b=b.multiply(BigInteger.valueOf(i));
	}
	return b;
}

public static void main(String args[]) {
	Scanner sc=new Scanner(System.in);
	int n=sc.nextInt();
	int []arr= new int[n];

	for(int i=0;i<n;i++){
		arr[i]=sc.nextInt();
	}
	BigInteger sum=new BigInteger("0");
	for(int i=0;i<n;i++){
		BigInteger x=(sum.add(fact(arr[i])));
		BigInteger t= new BigInteger("107");
		BigInteger y= x.mod(t);
		System.out.println(y);
	}
}

}

save your code on ide.codingblocks.com and share its link

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.