Find the sum of all even numbers in an array {4, 7, 10, 13, 18}.
MediumProblem Statement
Find the sum of all even numbers in an array {4, 7, 10, 13, 18}.
Sample Input
4 7 10 13 18
Sample Output
Sum of even numbers: 32
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
#include <stdio.h>
int sumEvenNumbers(int arr[], int n) {
// Your code here
}
int main() {
int arr[] = {4, 7, 10, 13, 18};
printf("Sum of even numbers: %d\n", sumEvenNumbers(arr, 5));
return 0;
}
Input
4 7 10 13 18
Expected Output
Sum of even numbers: 32