Deepak and primes problem


this code of deepak and primes problem of number theory is giving segmentation fault in coding blocks but working fine in other online compilers
please help