how to write algorithm and pseudocode and how to draw flowchart add the number from 1 to 100 and display the sum

1 answer

Algorithm:

1. Set sum to 0
2. For i from 1 to 100 do:
a. Add i to sum
3. Output sum

Pseudocode:

sum = 0
for i = 1 to 100 do
sum = sum + i
end for
output sum

Flowchart:

[Start] -> [sum = 0] -> [i = 1] -> [sum = sum + i] -> [i = 2] -> [sum = sum + i] -> ... -> [i = 100] -> [sum = sum + i] -> [Output sum] -> [End]