It’s the same code as shown in the video. Could you check and tell me where I’m wrong? It’s showing runtime error in CB editor.
public static void calculate(BigInteger n, BigInteger k){//n -> sum
BigInteger x,y;
y = n.subtract(k);
y = y.divide(BigInteger.valueOf(2));
x = y.add(k);
System.out.println(x);
System.out.println(y);
}
public static void main (String[] args) throws java.lang.Exception
{
Scanner scn = new Scanner(System.in);
BigInteger totalApples, diffBwTwo, ans;
int tests = 10;
while(tests > 0){
totalApples = scn.nextBigInteger();
diffBwTwo = scn.nextBigInteger();
calculate(totalApples, diffBwTwo);
tests -= 1;
}
}