Pagini recente » Cod sursa (job #1391007) | Cod sursa (job #120942) | Statistici Osztian Attila (osztianattila) | Cod sursa (job #304222) | Cod sursa (job #2217210)
#include <iostream>
#include <fstream>
using namespace std;
bool prime (int x){
if (x==1)
return false;
if(x==0)
return false;
if(x==2)
return true;
for(int i=2;i*i<=x;i++)
if(x%i==0 and x!=1 and x!=0 and x!=2)
return 0;
return 1;
}
int main()
{
int N,c=0;
ifstream f("ciur.in");
ofstream g ("ciur.out");
f>>N;
for(int i=2;i<=N;i++)
if(prime(i)==true)
c++;
g<<c;
return 0;
}