calculate prime numbers with sieve of eratosthenes code example
Example: prime of sieve
//sieve of eratosthenes or prime of sieve
#include
#include
using namespace std;
void primeofsieve(long long int n)
{
long long int arr[n]={};
for(int i=2;i<=sqrt(n);i++)
{
for(long long int j=i*i;j<=n;j+=i)
arr[j]=1;
}
for(long long int i=2;i<=n;i++)
{
if(arr[i]==0)
cout<>n;
cout<<"PRIME NUMBERs ARE : ";
primeofsieve(n);
return 0;
}