mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
Co-authored-by: Idrish Laxmidhar <idrish.l@hcl.com> Co-authored-by: Vishal Sharma <mrvishalsharma@users.noreply.github.com> Co-authored-by: David Leal <halfpacho@gmail.com>
This commit is contained in:
parent
5d34de836e
commit
f9a1acd4c3
@ -29,7 +29,7 @@ bool is_prime(T num) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (num >= 3) {
|
if (num >= 3) {
|
||||||
for (T i = 3; (i * i) < (num); i = (i + 2)) {
|
for (T i = 3; (i * i) <= (num); i = (i + 2)) {
|
||||||
if ((num % i) == 0) {
|
if ((num % i) == 0) {
|
||||||
result = false;
|
result = false;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user