You are given an integer array of size N, having elements A1,A2,A3,...,An. Your task is to find the sum of all even elements, sum of all odd elements and also find the absolute difference between the sum of even elements and the sum of odd elements of the array.
Input:
First line of input contains a integer value N,denoting the size of array.
Second line of input contains N integer values(N elements of the array).
Output:
First line of output contains two space seperated integers ,
The sum of even elements and the sum of odd elements.
Second line of output contains,
The absolute difference between the sum of even elements and the sum of odd elements of the array.
Constraints:
1<=N<=10^5
1<=Ai<=10^9
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
No editorial available for this problem.