Exercise: Get nth Prime Number
Write code to solve the problem.
Question
Write a program that takes a positive integer n as an input returns the nth prime number. If the input is not a positive integer, it returns 0.
Sample input:
getNthPrime(1)getNthPrime(3)getNthPrime(1000)
Sample output:
257919
Exercise: Get nth Prime Number
Write code to solve the problem.
Question
Write a program that takes a positive integer n as an input returns the nth prime number. If the input is not a positive integer, it returns 0.
Sample input:
getNthPrime(1)getNthPrime(3)getNthPrime(1000)
Sample output:
257919