I know the mistake here is in the for loop as it should be i=2 but if i put it as i=1 then why is it not entering in the loop .could someone dry run this code and tell me how exactly is this an issue
if(n==2)
{ return true;}
for(int i=1;i<=Math.sqrt(n);i++){
if(n % i == 0){
return false;
}
}
return true;