This is just a simple program to find the 'n' th prime number in the prime number series using C++, where the n value should be given by the user.
Starting off with the needed header files, we declare the main() function to make the compiler to start the program.
Next we declare and initialize the needed variables and functions.
Using cout and cin, we ask and get in the value of the 'n'.
Next we have to find out the 'n' number of prime numbers in ascending order. For that, we use two for loops and a function to check whether the number is prime or not, which has been defined outside the main().
With the help of that function, we do the prime number check and using if else statement, if the number is not a prime, it is left out and else if it is prime, the number is taken inside a vector array.
For the insertion of each prime number, the count of total prime numbers inserted inside is calculated by another separate variable.
If the count and the number given by the user is matched, the place of the prime number is found out and displayed on the output screen as below,
Submitted by DEVADHARSHINI M (deva)
Download packets of source code on Coders Packet