`#include<stdio.h>
include<math.h>
include<sys/time.h>
include<unistd.h>
int main()
{
struct timeval tv1,tv2;
struct timezone tz;
int t,i,j,n;
int count=0,sum=0;
printf("请输入一个数n:");
scanf("%d",&n);
gettimeofday(&tv1,&tz);
for(i=2;i<=n;i++)
{
for(j=2;j<=i;j++)
{
if(i%j0)
break;
}
if(ji)
{
count+=1;
sum+=i;
}
}
printf("sum=%d \n",sum);
gettimeofday(&tv2,&tz);
t=tv2.tv_sec-tv1.tv_sec+(tv2.tv_usec-tv1.tv_usec)*pow(10,-6);
printf("t=%d \n",t);
return 0;
}`