— And sqrt mb ?
— Also you should move than int d=2; into the for, like so:for(int d = 2; d <= a; d++)
for(int d = 2; d <= a; d++)
— If he's testing small numbers it might be slower, but for anything slighly larger, yes
Steve if a number isn't divisable (with a remainder of 0) by any of the numbers smaller than it's square root, it's prime
— So you're doing some unnecessary checks
— The condition can also be d*d<=a
— But still getting error when i run
— Well what's the error?
— Can someone please send me the code
— No, tell us the error
— You're missing an init statement
— And also your logic isn't correct