#C13031. Filter Prime Numbers
Filter Prime Numbers
Filter Prime Numbers
You are given a list of integers. Your task is to filter out all the prime numbers from the list and output them in the same order as they appear in the input.
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Use the standard input and output for reading and writing.
The solution should process the input from stdin
and print the filtered prime numbers to stdout
. If there are no prime numbers in the list, output nothing (an empty line).
inputFormat
The first line contains an integer N, the number of integers in the list. The second line contains N space-separated integers.
outputFormat
Output the prime numbers found in the list, separated by a single space. If no prime number exists in the list, output an empty line.
## sample6
10 15 3 7 9 2
3 7 2