Faulty Algorithm?

Alex wants to create an algorithm to calculate the sum of the first 100 positive integers.

He tells the algorithm to
1. Create the variable sum with an initial value of 0.
2. Start with the value of \( i = 1 \)
3. Add \(i\) to the sum
4. Add 1 to \(i\)
5. Continue doing so till \( i = 100 \)

Does this algorithm work?

×

Problem Loading...

Note Loading...

Set Loading...