I am having a problem in implementing of sieve of eratosthenes..
please check the code and tell me the error
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int i,j;
long array[100001];
int count=0;
for(i=1;i<100001;i++)
{
array[i]=i;
}
for(i=2;i<100001;i++)
{
if(array[i]!=0)
{
cout<<""<<array[i]<<endl;
int j=0;
j=i*i;
while(j<100001)
{
array[j]=0;
j+=i;
}
}
}
}