Cod sursa(job #273765)
Utilizator | Data | 8 martie 2009 23:28:26 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.29 kb |
#include <stdio.h>
#include <math.h>
long i, n, s;
int main()
{
FILE *f=fopen("ciur.in", "r");
fscanf(f, "%ld", &n);
fclose(f);
s=n;
f=fopen("ciur.out", "w");
//if(n==2) fprintf(f,"1");
for(i=2; i<sqrt(n); i++)
s-=(n/i);
fprintf(f, "%ld", s+2);
fclose(f);
return 0;
}