#K39367. Odd Squares Computation
Odd Squares Computation
Odd Squares Computation
Given a list of integers, compute the square of every odd integer. More formally, if the input list is \(A = [a_1, a_2, \ldots, a_n]\), then produce a list \(B\) where each element is \(b_i = a_i^2\) if \(a_i\) is odd. The order of the elements in \(B\) should be the same as their order in \(A\).
Input Format: The first line contains a single integer \(n\), the number of elements in the list. The second line contains \(n\) space-separated integers.
Output Format: Print all the squares of the odd elements in a single line, separated by a space. If there are no odd elements, print an empty line.
Example:
Input: 5 2 3 4 5 6</p>Output: 9 25
inputFormat
The input consists of two lines. The first line contains an integer (n) representing the number of integers. The second line contains (n) space-separated integers.
outputFormat
Output a single line containing the squares of every odd integer from the list, separated by a space. If there are no odd elements, output an empty line.## sample
5
2 3 4 5 6
9 25
</p>