Why isn't this perfect square finder working for some numbers?

49 Views Asked by At
public static boolean isSquare(int n) {
if (n < 0) {     
  return false;
}
if (n == 0) {
  return true;
}
for (int i = 0; i <= n; i++) {
  if (i * i == n) {     //checks if no. is perfect square//     
    return true;
  }
}
return false;
}

why isn't this code working for some numbers such as 219433929?

0

There are 0 best solutions below