Wednesday, March 25, 2009

What does this algorithm compute and print?

What does the algorithm


set s to 0


set i to 1


while i<5 do the following:


set s to s i


set i to i 1


print s


compute and print?


A. 15


B. 8


C. 12


D. 5


E. 10



10.





You have added the numbers from 1 through 4 (1 2 3 4).

No comments:

Post a Comment