Cod sursa(job #215199)
| Utilizator | Data | 17 octombrie 2008 18:59:50 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include<stdio.h>
#include<math.h>
long long n, i, nrprime, check, j;
int main()
{
freopen("ciur.in","r",stdin);
freopen("ciur.out","w",stdout);
scanf("%lld",&n);
check=1;
nrprime=0;
if (n==2)
nrprime=1;
if (n>2)
{
nrprime=1;
for (i=3;i<=n;i=i+2)
{
check=1;
for (j=2;j<=sqrt(i);j++)
if (i%j==0)
check=0;
if (check==1)
nrprime++;
}
}
printf("%lld", nrprime);
return 0;
}
