Skip to content
Advertisement

Program to find the nth prime number

I wrote a code in python to find the nth prime number.

JavaScript

The code looked fine to me, but it returns an error when I run it:

JavaScript

It appears to me as if it is trying to say that I am referring to ptrue in the last line even though I am not. What is the problem here… Can anyone help?

Advertisement

Answer

how about using Boolean ? and initalize ptrue out of while loop

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement