- 2

Java Prime NUmbers

Print Prime numbers PrepBuddy knows that Tina loves prime numbers, so PrepBuddy gives Tina an array of integers, and asks Tina to print only prime numbers from that array. Tina is too busy, so Tina is asking for your help. Input format First line contains test case variable T . T test cases follow: First line of each test case contains N representing the size of the array. Second line contains N space-separated integers. Output format For each test case, print only prime numbers in the same order as in the input array. Note: Array will contain atleast one prime number. Constraints 1 <= N <= 20 1 <= A [ i ] <= 1000 Example Input 2 5 1 2 3 4 5 7 19 25 23 37 26 50 100 Output 2 3 5 19 23 37

12th Oct 2019, 12:46 PM
Pranay Tupkar
Pranay Tupkar - avatar
1 Resposta
0
You posted this question twice
12th Oct 2019, 12:46 PM
Aymane Boukrouh
Aymane Boukrouh - avatar