0
How to get sum of even elements in while loop in script ?
In script we can find even numbers but how to get the sum of these even numbers.
2 Answers
+ 1
sum = 0
i = 0
while i < max:
i+=2
sum += i
This should do it
+ 1
Jay Matthews Really good O(1) solutionđ Ill remember thatđđ