#C12635. Square Odd Numbers in a List

    ID: 42084 Type: Default 1000ms 256MiB

Square Odd Numbers in a List

Square Odd Numbers in a List

You are given a list of integers. Your task is to generate a new list where each odd integer is replaced by its square, while each even integer remains unchanged. Formally, for any integer (x), if (x) is odd then it is replaced by (x^2); if (x) is even then it remains the same. This problem tests basic list manipulation and conditional operations.

inputFormat

The first line contains an integer (n), which represents the number of elements in the list. The second line contains (n) space-separated integers.

outputFormat

Output the transformed list as space-separated integers on a single line.## sample

4
1 3 5 7
1 9 25 49