- 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

5th Jun 2019, 3:01 PM
Aditya Kumar
Aditya Kumar - avatar
1 Respuesta
0
Thank you for answering
5th Jun 2019, 4:41 PM
Aditya Kumar
Aditya Kumar - avatar