Sum Difference Given an array of integers, write a program to find the difference between the sum all the even numbers in the array and sum of all odd numbers in the array. You can subtract the sums...



Sum Difference


Given an array of integers, write a program to find the difference between the sum
all the even numbers
in the array and sum of
all odd numbers
in the array. You can subtract the sums in whatever order you wish but the function must always return a
positive
integer. Please complete a function called
SumDiff, which takes an argument of an array of numbers and returns an integer.


function SumDiff(numbers) {
// your code here
// returns an integer
}


Example test case:
Input: [1,5,8,2,10,33,36]
Output: 17
Reasoning: (8 + 2 + 10 + 36) - (1 + 5 + 33) = 17



Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here