#K74007. Even Product and Odd Sum
Even Product and Odd Sum
Even Product and Odd Sum
Given an array of (n) positive integers, compute the product of the elements at even indices and the sum of the elements at odd indices. In other words, if the array is (a_0, a_1, \ldots, a_{n-1}), you are required to calculate (\prod_{\text{even } i} a_i) and (\sum_{\text{odd } i} a_i).
For example, for the input array [2, 3, 4, 5, 6, 7]:
(\text{even product} = 2 \times 4 \times 6 = 48)
(\text{odd sum} = 3 + 5 + 7 = 15)
inputFormat
The input is read from standard input (stdin). The first line contains an integer (n), which denotes the number of elements in the array. The second line contains (n) space-separated positive integers.
outputFormat
Output two numbers to standard output (stdout): the product of elements at even indices and the sum of elements at odd indices, separated by a space.## sample
6
2 3 4 5 6 7
48 15