Cod sursa(job #381737)
Utilizator | Data | 11 ianuarie 2010 13:39:52 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.25 kb |
#include<fstream.h>
long n,c,nd,x;
ifstream fin("ciur.in");
ofstream fout(" ciur.out");
int main()
{
fin>>n;
for(c=2;c<=n;c++)
{
nd=0;
for(x=2;x*x<=c;x++)
if(c%x==0)
nd++;
if(nd==0)
fout<<c<<" ";
}
return 0;
}