Even and Odd
Practice
3.7 (3 votes)
Problem
67% Success 311 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
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
Submissions
Please login to view your submissions
Similar Problems
Points:20
3 votes
Tags:
Easy
Points:20
1 votes
Points:20
27 votes
Tags:
Brute-force searchMathematicsApprovedEasy
Editorial
No editorial available for this problem.