#K72297. Sum of Even Numbers
Sum of Even Numbers
Sum of Even Numbers
Given a list of integers, compute the sum of the even numbers. If the list is empty, output No numbers given
. If there are no even numbers in the list, output 0. The input is provided via standard input and the result should be printed to standard output.
Mathematically, if the input list is \( A = [a_1, a_2, \ldots, a_n] \), then compute \( S = \sum_{a_i \text{ is even}} a_i \). If \( n = 0 \) (empty list), then output "No numbers given".
inputFormat
The first line of input contains a non-negative integer \( N \) which represents the number of integers in the list. If \( N > 0 \), the second line contains \( N \) space-separated integers.
outputFormat
Output a single line. If \( N = 0 \), print No numbers given
. Otherwise, print the sum of all even numbers in the list. If no even numbers exist in the provided list (and \( N > 0 \)), print 0.
6
1 2 3 4 5 6
12