Next: Exercises
Up: Further Structured Design
Previous: Summary
set sum to zero.
set i to 1.
input n.
while i is less than or equal to n do
{
add i to sum.
increment i.
}
output sum.
What would be output if the value entered for n was 0? What would be
the effect of reversing the order of the statements in the loop body
on the general result produced by the algorithm?