FastPrepFastPrep
Problem Brief

Find Out Prime or Composite

INTERNOA
See Cisco online assessment and hiring insights

Given a list of integers, write an algorithm to find out if the elements are prime or composite.

Input

The first line of input consists of an integer inputList-size, representing the number of elements in the list (N). The next line consists of N space-separated integers representing the elements of the list.

Output

Print N line-separated "Prime" if the element is a prime number else print "Composite" if the element is a non-prime number.

Note

Prime numbers are those positive integers that have no positive integer divisors other than 1 and itself.

1Example 1

Input
size = 5, elements = [541, 37, 113, 5, 10]
Output
"Prime Prime Prime Prime Composite"
Explanation

From the given list, elements (541, 37, 113, 5) are prime numbers and (10) is a composite number.

public String findOutPrimeOrComposite(int size, int[] elements) {
  // Write your code here
      
}
Input

size

5

elements

[541, 37, 113, 5, 10]

Output

"Prime Prime Prime Prime Composite"

Sign in to submit your solution.