Question: (a) Determine the value of the integer variable counter after execution of the following program segment. (Here i, j, and k are integer variables.) counter
counter : = 0
for i := 1 to 12 do
counter : = counter + 1
for j := 5 to 10 do
counter : = counter + 2
for k : = 15 down to 8 do
counter := counter + 3
(b) Which counting principle is at play in part (a)?
Step by Step Solution
3.39 Rating (155 Votes )
There are 3 Steps involved in it
a The for loop for i is executed 12 times while thos... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
954-M-L-A-L-S (7215).docx
120 KBs Word File
