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 {
Problem is value of num is always 2 at the start of loop,even if you say num++ again it takes num=2 which is start statement and wont enter into for loop ever,hence so infinite loop.This will Work
num++
num=2
int num=2; while(count!=n) { for(int i=2;i