Is Average Whole Number
ARRAY
MATH

Problem

Given an array of integers numbers, return true if the average of all elements is a whole number, and false otherwise.

Examples

isAvgWholeNumber([1, 2, 3, 4]) // false // (1 + 2 + 3 + 4) / 4 = 2.5 which is not a whole number isAvgWholeNumber([5, 8, 8]) // true // (5 + 8 + 8) / 3 = 7 which is a whole number isAvgWholeNumber([1, 1, 1, 7]) // false // (1 + 1 + 1 + 7) / 4 = 2.5 which is not a whole number
Loading...