#K61622. Sum of Even Numbers
Sum of Even Numbers
Sum of Even Numbers
You are given an array of integers. Your task is to compute the sum of all even numbers in the array. An integer n is even if it satisfies the condition \( n \mod 2 = 0 \). This applies to both positive and negative even numbers. If the array is empty, the sum is defined to be 0.
For example, given the array [1, 2, 3, 4, 5, 6], the even numbers are 2, 4, and 6, whose sum is 12.
inputFormat
The input is provided via stdin and consists of two lines:
- The first line contains an integer \( n \) indicating the number of elements in the array.
- The second line contains \( n \) space-separated integers representing the array elements. If \( n = 0 \), this line may be empty.
outputFormat
Output a single integer to stdout representing the sum of all even numbers in the given array.
## sample6
1 2 3 4 5 6
12
</p>