Pagini recente » Cod sursa (job #2894625) | Cod sursa (job #2875437) | Cod sursa (job #923630) | Cod sursa (job #651098) | Cod sursa (job #896535)
Cod sursa(job #896535)
# include <fstream>
using namespace std;
ifstream cein ("ciur.in");
ofstream ceou ("ciur.out");
int n,k,i,y,x,m;
bool a[1001];
int ciur ();
void ceifs ()
{
cein>>n;
}
void ceofs ()
{
ceou<<ciur();
}
int main ()
{
ceifs ();
k = 0;
ceofs ();
}
int ciur ()
{
for (i = 2; i <= n; i++)
a[i] = true;
if (a[i])
for (y = 2; y <= n; y++)
for (m = 2*y; m <= n; m += y)
a[m] = false;
for (x = 2; x <= n; x++)
if (a[x])
k++;
return k;
}