Answer to Question #182408 in MatLAB for Jordan

Question #182408

Examine the following loops and determine the number of times the loop executes and the final value of ires at the termination of the loop.

a) ires = 0;

for index = -12 : 12

ires = ires + 1;

end 

b) ires = 0;

for index = 10 : -2 : 1

if index == 6 continue

end

ires = ires + index;

end 

c) ires = 2;

while ires <= 100

ires = ires.^2;

end

d) ires = 2;

while ires > 100

ires = ires.^2;

end


1
Expert's answer
2021-04-17T05:58:19-0400

a)

ires = 21

count = 21

b)

ires = 22

count = 4

c)

ires = 18

count = 3

d)

ires = 24

count = 11


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS