Problem #4

Code Wars II
Danger Level: Green



}Nth Prime Number~

Point Value: 3
 

Problem Statement

Prime numbers are used in many program algorithms, including hash tables and encryption.  Write a program to display the Nth prime number for a given value of N.
 

Program Input

The program should read a single integer from the input line (keyboard).  This is the value of N to be used later.  After displaying the output, the program should continue reading values for N until the user presses the '.' key.

1
4
10
.
 

Program Output

The program should display the value of N and the Nth prime number to the screen.  The program may assume that N will be in the range 1 through 9999, inclusive.  Here are the values for the above input:

The 1st prime number is 2.
The 4th prime number is 7.
The 10th prime number is 29.
Done.