#include<iostream>
using namespace std;
int main()
{int n,ciur[100],i,j;
cout<<"n=";cin>>n;
for(i=0;i<=n;i++)
ciur[i]=1;
for(i=2;i<=sqrtl(n);i++)
if(ciur[i]==1)
for(j=2*i;j<=n;j=j+i)
ciur[j]=0;
for(i=2;i<=n;i++)
if(ciur[i]==1)cout<<i<<endl;
}
Orar semigroup #2
Ciuril lui Eratostene
vineri, 9 iulie 2010
by DlMuresan
Categories:
info,
vectori
|
Leave a comment