for i:= step 2*j until 10-j do:=i+1; assume the initial value of j is 1; list th
ID: 3533284 • Letter: F
Question
for i:= step 2*j until 10-j do:=i+1;
assume the initial value of j is 1; list the value of i that are used in the execution of the loop and also which value of i causes the exits from the loop if:
a) it is dynamic loop witha loop parameters changing whenever thier variable are changed
answer: 1,5,exit when i=11
b)it is dynamic loop with loop parameters reevaluated once before each iteration (ie just befor the exist-check)
answer: 1,3,7 exit when i=13
i know the asnwer has u can see, but how do you get them , i never done algol before , can anyone explain what is happening?
thanks,
Explanation / Answer
a) I dont know how to get 1 and 5..
but... 11 is like...
2+2+2+2+2+1 = 11 ( checking for exist)
b) i dont know how to get 1,3,7... but
2+2+2+2+2+2+1 = 13 ( before check for the exist)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.