Answer the question
In order to leave comments, you need to log in
Why does an int cannot be converted to java.math.BigInteger error pop up?
When using the method, it gives an error int cannot be converted to java.math.BigInteger, although I have translated BigInteger into Integer
public static String oddity(BigInteger n) {
int n2 = n.intValue();
int count = 0;
for(int i = 1; i <= n2; i++){
if(n2 % i == 0){
count++;
}
}
if(count % 2 == 0){
return "even";
}
return "odd";
}
Answer the question
In order to leave comments, you need to log in
Apparently, because instead of BigInteger you shove it into the int method
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question