Instructions: The first problem asks you to read a function and determine what it does. The second problem asks you to write a function given a description.
# Comment: A function with 2 parameters
To function(M, N):
Set global Var to 0
While M <= N do:
Set Var to Var + M
Set M to M + 1
Return Var
sumOdds( [1,2,3,4,5] )
it will return 9 because 1 + 3 + 5 = 9.
Instructions: The next two problems ask you to read and write
loop algorithms.
# Comment: What is the final value of Var
Set global Var to 0
For each item in list do:
If item > length(list) then do:
Set Var to Var + item