#include <stdio.h>
#include<math.h>
int main()
{
int n;
int i,j;
double k;
printf("请输入n的数值:\n");
scanf("%d",&n);
for(i = 2; i <= n; i++)
{
for(j = 2,k = sqrt(i); j <= k; j++)
if(i%j==0)
break;
if(j > k)
<img src="https://img-blog.csdn.net/20150415223030956" alt="" /> printf("%d\t",i);
}
printf("\n");
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;">return 0;</span>
}