the following program displays the pth prime number.....but the program is not working ......plz help
#include<stdio.h>
#include<conio.h>
void main()
{
long int a=0,n=0,i=2,j , p ;
printf("insert the number") ;
scanf("%ld",&p);
while(n!= p-1)
{
for(j=2 ; j<=i-1 ; j++)
{
if(i%j == 0)
{
a==1 ;
break ;
}
}
if (a==1)
{
n=n+1 ;
a=0 ;
}
i=i+1 ;
}
printf("%ld",i);
getch() ;
}