Cod sursa(job #884932)
Utilizator | Data | 21 februarie 2013 14:55:08 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.51 kb |
#include<stdio.h>
int n,x,y,c,z;
int main()
{
freopen("ciur.in","r",stdin);
freopen("ciur.out","w",stdout);
scanf("%d",&n);
x=2;
z=0;
while(x<=n)
{
y=1;
c=0;
while(y<=x)
{
if(x%y==0)
{
c=c+1;
}
y=y+1;
}
if(c==2)
{
z=z+1;
}
x=x+1;
}
printf("%d",z);
fclose(stdin);
fclose(stdout);
return 0;
}