+ 1
PROGRAME TO FIND OUT THE "N"TH PTIME NUMBER
first give any integer value as input and print the corresponding prime number on that number position. Test cases : input n = 5, output will be 11. because on 5 the position prime number 11 exists.
6 ответов
+ 3
Create a prime checker then iterate from 1 to infinity
+ 1
on which language please?
CPP or java or .....
+ 1
Java or cpp
+ 1
Pseudo-code then... (You didn't specify, not even when others asked you to)
variable current_number=1
variable count_prime=1
while count_prime is lower than input
do
variable aux=1
while aux lower or equal to (current_number/2) round down
do
if current_number mod (aux) = 0
do
continue
done
aux=aux+1
done
current_number = current_number+1
done
print count_prime
This is a not too accurate way, but it's the code itself. Next time, please provide some more info, or a bit of what you tried before.
+ 1
got it now :-)
0
@myenemy.. there is no need for such type of information. i already mention everything into the question. prime numbers start from 2,3,5,7,11..... so on. if I give the input 3.. output will be 5. because at 3rd position prime number is 5