Cod sursa(job #795313)

Utilizator skyper96skyper skyper96 Data 8 octombrie 2012 11:47:35
Problema Ciurul lui Eratosthenes Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.41 kb
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    ifstream f("ciur.in");
    ofstream g("ciur.out");
    int n,nr,nd,i,j;
    f >> n;
    nr=0;
    for(i=2;i<=n;i++)
    {
        for(j=2;i<=n/2;j++)
        {
            nd=0;
            if(n%j==0)
                nd++;
            if(nd==1)
                nr++;
        }
    }
    g << nr;
    return 0;
}