if(lis[i]%2 == 0)//if the number is even adding to sum_e.
sum_e=sum_e+i;
}
return sum_e;//retuning the sum.
}
Explanation:
The above written function is in C++.This function find the sum of even numbers in the list provided.It loops over the array and if the number is even adds to the variable sum_e finally return sum_e which having the sum of even numbers now.