005 An Algorithm A Day
005 An Algorithm A Day
Algorithm Question
Consider the array numbers = [2, 5, 3, 6, 2, 3, 6, 4] where the value of numbers[2] is 3.
***There are always different ways to solve a problem. This algorithm is just an example.
What is important is that the logic is correct!***
LOGIC:
EXAMPLE ALGORITHM:
total = 0
for counter = 0 to (numbers.length – 1)
total = total + numbers(counter)
print(total)