Find it code doubt

giving segmentation error , cant debug

at line 25
for(ll j=i;i<p;j=j+i){
sum[i] = sum[i]+ c[j];

the loop is infinite as i<p is always true for a given i
change it to j<p