Cod sursa(job #1976724)

Utilizator teolegotechnicteolegotechnic teolegotechnic Data 4 mai 2017 08:33:28
Problema Ciurul lui Eratosthenes Scor 20
Compilator cpp Status done
Runda Arhiva educationala Marime 0.38 kb
#include <fstream>

using namespace std;
ifstream in("ciur.in");
ofstream out("ciur.out");
int main()
{
    int n,i,j,jeep=0; bool skoda;
    in>>n;
    for(i=2;i<=n;i++)
    {
        skoda=1;
        for(j=2;j<=i/2;j++)
        {
            if(i%j==0)
               skoda=0;
        }
        if(skoda==1)
            jeep++;
    }
    out<<jeep;
    return 0;
}