Do a careful hand simulation of computation of
sum(4) using the
following definition of sum. Show how variables
k and r change, and what the answer is.
Define
sum(n) = r |
Let k = 1.
Let r = 0.
While k <= n do
Relet r = r + k.
Relet k = k + 1.
%While
%Define