Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

function that returns the average of a given array of numbers

const average = arr => {
  const sum = arr.reduce((acc, num) => acc + num, 0)
  return sum / arr.length
}
 
PREVIOUS NEXT
Tagged: #function #returns #average #array #numbers
ADD COMMENT
Topic
Name
2+1 =