Update sumAll.js

Corrected sum formula which is line 11
This commit is contained in:
Huseyin Daniel Ozdogan 2020-09-14 17:05:27 +03:00 committed by GitHub
parent 3b51e5dbef
commit d727e247c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -8,7 +8,7 @@ const sumAll = function(min, max) {
}
let sum = 0;
for (let i = min; i < max + 1; i++) {
sum += i;
sum += (((max-min)+1)/1)*((max+min)/2);
}
return sum;
};