Large prime check

Could you explain the bool function, the for loop part. Why do we take primes[i]*primes[i]<=no? What is wrong with this code?

hello @Sharleen-Clement-3051084341644767 please wait i will go through your code and let you know the error in your code:

we are doing prime[i]*prime[i]<=no because here we are checking for all the devisors of prime number less then route n.
if the number in this range divides the number then it is not the primenumber otherwise it will be the prime number.

Okay thank you. I’m still getting some error in my code.

hey @Sharleen-Clement-3051084341644767 please see this code :


i have corrected and commented the code.
Happy Learning !!

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.