Skip to content

Commit 75b3156

Browse files
problem 46 solved successfully
1 parent 32f870e commit 75b3156

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

problem46/problem46.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,24 @@
55
3. Return the average of the sum of the squared elements
66
77
**Print the result. */
8+
9+
10+
11+
const complexMathOperation = nums => {
12+
13+
let sumOfAllNumsSqure = 0;
14+
15+
for(const num of nums){
16+
17+
const squareOfNum = num * num;
18+
sumOfAllNumsSqure = sumOfAllNumsSqure + squareOfNum ;
19+
}
20+
21+
const averageOfAllNumsTotal = sumOfAllNumsSqure / nums.length;
22+
return averageOfAllNumsTotal;
23+
}
24+
25+
26+
const numbers = [10, 13, 45, 46];
27+
const result = complexMathOperation(numbers);
28+
console.log(result.toFixed(2));

0 commit comments

Comments
 (0)