Pagini recente » Cod sursa (job #2073527) | Rating Tambozi Cezar Justin (CezarT) | Probleme cu secvențe important | Cod sursa (job #691284) | Cod sursa (job #1569401)
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream f("ciur.in");
ofstream g("ciur.out");
int n, i, t, j, gasit = 1, k, nr = 0;
f >> n;
for(i=2;i<=n;i++)
{
t=i;
gasit = 1;
if((t%2==0)&&(t!=2)) gasit = 0;
else
{
for(k=3;k<=t/2;k+=2)
{
if(t%k==0) gasit = 0;
}
}
if (gasit==1) nr++;
}
g << nr;
f.close();
g.close();
return 0;
}