质数

#include<stdio.h>
#include<stdlib.h>
#include <math.h>
int main ()
{
int y,n,a,b,c,x;
scanf("%d",&n);
a=2;
c=1;
while(c<=n)
{

b=0;
y=2;
int x=sqrt(a);
while(y<=x)
{

if(a%y==0)
{
b++;
break;

}
y++;
}
a++;
if(b==0)
c++;

}
printf("%d",a-1);
return 0;
}

原文地址:https://www.cnblogs.com/Cathycat/p/11234906.html