What is the value of ii at the end of the loops for ii 2311

What is the value of ii at the end of the loops? for ii = 2:3:11 if H = 5 continue. end end What is the value of ires at the end of each of the loops? ires = 1 while mod(ires, 27)~ = 0 ires = 3 * ires; end What is the value of ires it the end of each of the loops? ires = -20; while ires > -50 ires = ires - 8; end

Solution

7)ii =11 will be after loop.because each time ii value will be 2,3,11.In if condition we check value of ii with 5 but it never becomes 5 hence it will not enter n loop.

8)mod(irees,27) will be 0 only if we have irees as multiple of 27.i.e.27,54......

hence in while irees will become 27 and loop will stop.Hence irees will be 27.

In while,irees value is multipled by 3 each time,hence it will help to attain irees as 27

9)each time in loop we decrease value of irees by -8

iteration 1:

irees=-20-8=-28

iteration 2:

irees=-28-8=-36

iteartion 3:

irees=-36-8=-42

iteartion 8:

irees=-42-8=-50

in iteeation 9,condition will fail as irees>-50.

hence its value will be -50 at last

 What is the value of ii at the end of the loops? for ii = 2:3:11 if H = 5 continue. end end What is the value of ires at the end of each of the loops? ires = 1

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site