0
output shows exceution timed out??
4 Answers
+ 3
Hello Harithra Shanmugam
I think you should rework your whole code (there are also many wrong brackets).
Use a for loop:
It starts at 2 and ends at Math.sqrt(yourNumber)
Now you only need to check if your number is divisible by i.
If yes -> not a prime
If not -> prime
You only need to be careful with 2 (it is prime and divisble by 2).
+ 3
Your condition says 'while a==0'.
You never change it in the loop, so it runs forever.
0
Link the code pls