第1个回答 2012-02-24
#include<stdio.h>
#include<string.h>
main()
{
int n,t,i,j;
for(;;)
{
system("cls");
printf("请输入素数的取值范围:\n");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
t=0;
for(j=2;j<i;j++)
{
if((i%j)==0)
t=1;
}
if(t==0)
printf("%d ",i);
}
system("pause");
}
}