Cod sursa(job #2663085)
Utilizator | Data | 25 octombrie 2020 12:16:47 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 20 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include <fstream>
using namespace std;
ifstream in ("ciur.in");
ofstream out ("ciur.out");
int main()
{
int n,i,j,p,q=0;
in>>n;
for(i=2;i<=n;i++)
{
p=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
p++;
}
if(p==2)
q++;
}
out<<q;
return 0;
}