My Code is not showing any output

void prime_seive(int *p) {
for(int i=3;i<1000000;i+=2) p[i]=1;

p[2]=1;
p[1]=p[0]=0;

for(int i=0;i<=1000000;i++)
{
    if(p[i]==1)
    {
        for(int j=i * i;j<=1000000;j+=i)
        {
            p[j]=0;
        }
    }
}

}

int main(){

int n;
cin>>n;

int p[1000005] = {0};
prime_seive(p);


for(int i=0;i<=n;i++){
	if(p[i]==1) cout<<i<<" ";
}

return 0;

}

You haven’t imported any libraries or maybe its not visible here. So save your code on ide.codingblocks.com and share the link

It is successfully executing here but not showing any output on my machine

@aditya001tomar your code is working fine, maybe some technical error in your machine.

@sdevwrat Can it be a compiler issue?

yeaah that maybe possible.

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.