Cod sursa(job #872545)
Utilizator | Data | 6 februarie 2013 10:59:13 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.25 kb |
#include<iostream.h>
#include<fstream.h>
int main()
{
ifstream f("ciur.in");
ofstream g("ciur.out");
int n,i,s=0,nr=0,d;
f>>n;
for(i=1;i<n;i++)
{
nr=0;
for(d=1;d<=i;d++)
if(i%d==0)
nr++;
if(nr==2)
s++;
}
g<<s;
}