Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Determining When a Loop Will Stop It is important to be able to determine when a

ID: 3528930 • Letter: D

Question

Determining When a Loop Will Stop It is important to be able to determine when a loop will stop. The following question uses a maple command to determine if a variable is even or odd. The command is called type. type(i,even) will return true if i is even and false if i is odd. type(i,odd) will return true if i is odd and false if i is even. The following script preforms a loop that stops after 18 even numbers are encountered. #Start of Script restart; evenNumbersFound:=0; #Count how many even numbers are found in evenNumbersFound #Stop after 18 even numbers have been found for i from 1 while evenNumbersFound < 18 do i:= i+evenNumbersFound; if type(i,even) then evenNumbersFound:= evenNumbersFound+1; end if; end do: #end of script A.) How many times does the for loop in the script execute? B.) What is the final value of i? I know how to solve B), but I have no idea about A, please help me, thanks

Explanation / Answer

18 times

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote