Why it is giving Segmentation Fault?

You are calculating primes only till N, which is very small.

I changed but still, it is not passing all the test cases. Can you edit my code and mark where I am wrong?

Must be due to that calculation part, I have changed that, now it’s working https://ide.codingblocks.com/s/574091

I think this code is for another question…? My doubt is in " deepak-and-primes-ii " question.

Please check this https://ide.codingblocks.com/s/574636

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.