Week 8 Tutorial & Lab Prep Solution ==================================== Exercises 12.2, 12.3 and 12.6 12.2a The final value of i is 10, of sum is 45 12.2b The loop computes the sum of the ints 1..9 inclusive 12.3a There are no final values for i and sum since the loop does not terminate (i is never equal to 10) 12.3b The loop (tries to) compute the sum of the odd, positive integers. 12.6 a 10 (i=1,2 3,4,5,6,7,8,9,10) b 11 (i=0,1,2,3,4,5,6,7,8,9,10) c c is the same question exactly as b d 5 (i=0,2,4,6,8) e 10 (i=10,9,8,7,6,5,4,3,2,1) f 9 (i=10,9,8,7,6,5,4,3,2) g 5 (i=10,8,6,4,2) h 10 (i=10,9,8,7,6,5,4,3,2,1) i .. (i=9,7,5,3,1,-1,-3,-5,...) j .. (i=0,3,6,9,12,...)