0
Write a program to check if a number is prime in minimum iterations(time)..
hello,i have written a program n I want u to check if it can become more time efficient but reducing the no. of iterations....I have reduced the iterations as to half https://code.sololearn.com/cPa108ugyFbN/?ref=app https://code.sololearn.com/cPa108ugyFbN/?ref=app
2 Respuestas
+ 2
https://code.sololearn.com/cPa108ugyFbN/?ref=app
+ 7
For even smaller iterations, you may reduce the loop to maximum of Math.sqrt(no); This will also work in the same way, and will be faster.