yeah it is accepted now because i made some changes.
Before my program was calculating number of primes below 1000 which is 997 and for one corner case 997*997<1000000. So loop ran one more time with value of p[i]=0. That’s why some number got divided by zero and runtime error came.
But now i extended my number of primes and the solution got accepted