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

(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 : = 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

1 Expert Approved Answer
Step: 1 Unlock

a The for loop for i is executed 12 times while thos... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

954-M-L-A-L-S (7215).docx

120 KBs Word File

Students Have Also Explored These Related Linear Algebra Questions!