The sum of a given sequence
Problem Statement: Given a sequence: 20, 25, 30, 35, 40, 45, 50, 55, 60, calculate the sum.
Algorithm:
- Start
- Initialize a variable
sum
to 0. - Add each number in the sequence to
sum
:- Add 20 to
sum
. - Add 25 to
sum
. - Add 30 to
sum
. - Add 35 to
sum
. - Add 40 to
sum
. - Add 45 to
sum
. - Add 50 to
sum
. - Add 55 to
sum
. - Add 60 to
sum
.
- Add 20 to
- Display the value of
sum
. - End
Explanation: In this problem, we are simply summing up all the numbers in the given sequence. The algorithm iterates through each number and adds it to the cumulative sum.