0

My questions are how to find the nth prime number?

I have figured out how to find a list prime numbers.

I'm just stuck as for being able to change my code to

only print out the, say, 15th, or 500th prime not

every previous prime as well.

Any help/feed back would be great!!

thanks

```
#include<stdio>
main()
{
int primenumber;
int num;
int count;
int x;
num = 3;
printf("Prime number interested in finding a value for?\n");
scanf("%d",&primenumber);
if ( primenumber >= 1 )
{
printf("First %d prime numbers are :\n",primenumber);
printf("2\n");
}
for ( count = 2 ; count <= primenumber ; )
{
for ( x = 2 ; x <= num - 1 ; x++ )
{
if ( num%x == 0 )
break;
}
if ( x == num )
{
printf("%d\n",num);
count++;
}
num++;
}
return 0;
}
```