Cod sursa(job #624105)

Utilizator raazvvannheghedus razvan raazvvann Data 21 octombrie 2011 18:24:32
Problema Ciurul lui Eratosthenes Scor 20
Compilator cpp Status done
Runda Arhiva educationala Marime 0.32 kb
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
	ifstream f("ciur.in");
	ofstream g("ciur.out");	
	int n,j,i,x=0;
	bool ok;
	f>>n;
	for(i=2;i<=n;i++)
	{
		ok=true;
		for(j=2;j<i-1;j++)
			if(i%j==0) ok=false;
		if(ok==true) x++;
	}
	g<<x;
	f.close();
	g.close();
	return 0;
}