diff --git a/algorithms/Java/Maths/check-prime-or-not.java b/algorithms/Java/Maths/check-prime-or-not.java index 0a1f2ca2..354c9de3 100644 --- a/algorithms/Java/Maths/check-prime-or-not.java +++ b/algorithms/Java/Maths/check-prime-or-not.java @@ -10,7 +10,7 @@ public class main { public static boolean isPrime(int num) { for (int i = 2; i * i <= num; i++) { - if (num % 2 == 0) { + if (num % i == 0) { return false; } }