- 1
prime no. function problem
int isPrime(int num) { int i; for(i=2; i<=num/2; i++) { if(num % i == 0) { return 0; } } return 1; } why i<=num/2 ? also some uses i=sqrt(num) ? as end condition
1 Resposta
0
Thank you for answering
int isPrime(int num) { int i; for(i=2; i<=num/2; i++) { if(num % i == 0) { return 0; } } return 1; } why i<=num/2 ? also some uses i=sqrt(num) ? as end condition