HOW TO write algorithm and pseudocode

TO add the number 1 to 100 and display the sum

1 answer

Algorithm:

1. Set a variable sum as 0
2. Start a loop for i = 1 to 100
3. Within the loop, add the value of i to sum
4. End the loop
5. Display the value of sum

Pseudocode:

sum = 0
for i = 1 to 100
sum = sum + i
end for
display sum