30. Print Sum of Even Numbers

You are given an array of integers and its size. Using only pointer arithmetic:

  • Traverse the array
  • Find the sum of all even numbers
  • Print the sum 

❌ Do not use arr[ i ] indexing.
✅ Use only pointer movement and dereferencing.
 

Example-1

Input: n = 5, arr = [10 21 32 43 50]
Output: Sum = 92


Example-2

Input: n = 4, arr = [11 13 15 17]
Output: Sum = 0


Example-3

Input: n = 6, arr = [2 4 6 8 10 12]
Output: Sum = 42


 

Loading...

Input

5 10 21 32 43 50

Expected Output

Sum = 92