forked from M3-Academy/challenge-algorithms-v2.0
07-resolvido
This commit is contained in:
parent
d6eb8289d7
commit
79b6f8cb2b
@ -1,4 +1,17 @@
|
||||
import { sum } from "../06-sum";
|
||||
|
||||
export function sumEven(value) {
|
||||
// implementar logica aqui
|
||||
|
||||
let par = []
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
if (value[i] % 2 == 0) {
|
||||
par.push(value[i])
|
||||
}
|
||||
}
|
||||
let total = 0
|
||||
for (let i = 0; i < par.length; i++) {
|
||||
total += par[i];
|
||||
}
|
||||
value = [];
|
||||
return total;
|
||||
}
|
Loading…
Reference in New Issue
Block a user