This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.
import java.io.*;
class a
{
After correction i got the series of prime numbers.
import java.io.*;
class a
{
public static void main(String s[]) throws IOException
{
int count=1,count1=0;
String st;
System.out.println("how many prime no. do you want");
BufferedReader obj= new BufferedReader (new InputStreamReader (System.in));
st=obj.readLine();
int n=Integer.parseInt(st);
int num=2;
while(count<=n)
{
count1=0;
for(int i=2;i