unable to understand the loop and break’s working
Basic Prime Check
@jhanvi_10 hey jhanvi let us assume you’re checking whether 5 is prime is not so you will apply a loop from 2 to 4 because of it is easily divisible by 5 so if there is no such no exist which can divide 5 in the range of 2 to 4
5%2!=0
5%3!=0
5%4!=0
so 5 is the only no exist which can divide
so 5 is the prime no
let us assume if any no existed in between the range 2 to 4 we simply declare the given no as not prime and we break the execution and stop the process.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.