验证中...
Languages: C/C++
Categories: 其他
Latest update 2019-08-12 09:21
gistfile1.txt
Raw Copy
#include <stdio.h>
#include <math.h>
int is_prime(int n)
{
for(int i=2;i<=sqrt (n);i++)
{
if(n%i==0)
{
return 0;
}
}
return 1;
}
int main()
{
int n;
scanf("%d",&n);
int t=0;
for(int i=2;i<=n;i++)
{
if(is_prime(i))
{
if(is_prime(i+2)&&i+2<=n)
{
t++;
}
}
}
printf("%d",t);
}

Comment list( 0 )

You need to Sign in for post a comment

Help Search