Example trace
// Store 1 + 2 + 3 + 4 in s
s= 0; i= 1;
// General picture: s= 0 + 1 + 2 + � + i-1.
while (i != 5)
{s= s + i; i= i+1;}
Execution trace:
i | ? | 1 | | 2 | | 3 | | 4 | | 5 |
s | 0 | | 1 | | 3 | | 6 | | 10 | |
Previous slide
Next slide
Back to first slide
View graphic version