Why is this code not working and going to infinite? X is read and I must find the X prime number. Example: X=4 --- the fourth prime number is 7 and so on. Thank you guys!
Line 14: If the for from line 12 entered, then its condition (j<=i) is necessarily true, so the first time through this while will always enter.
Line 17: If the first time the while from line 14 entered j was less than i, then at this point i != j, since nothing else modified the value of either variable since line 14. The continue loops back to line 14, causing an infinite loop.