Arrays_ECEA_2021_2025


Submit solution

Points: 10
Time limit: 5.0s
Memory limit: 12M

Author:
Problem type
Allowed languages
C

Perform sum of even numbers in an ID Integer array. Input for the program is size of the ID Integer array and the elements of the array. 'a' is the variable name for the Integer array. 'size' is the variable name for the size of the array. 'i' is the counter variable used in loops.

Input
Line 1 contains number of test cases.
Line 2 is the size of the 1D integer array
Line 3 onwards to next size lines is the elements of the array


Output
Result is an integer value, which is the sum of even numbers in  the array.
If the input array contains no even numbers print the message as: "No Even numbers in the array"
Sample Input
2   // Number of test cases
5   // size of the array        // Input for Test case-1
3   // Entry of A[0]
4   // Entry of A[1]
5   // Entry of A[2]
6   // Entry of A[3]
7   // Entry of A[4]
4   // size of the array        // Input for Test case-2
3   // Entry of A[0]
1   // Entry of A[1]
7   // Entry of A[2]
9   // Entry of A[3]
Sample Output
10  // An Integer value which is the sum of even numbers in the array    // output of test case 1

No Even numbers in the array                                            // Output of test case 2

Comments

There are no comments at the moment.