Question

8 0/1 point How could the following code be re-written with a while loop? % find the index of the first value in A divisible
Tprint(The index of the tirst number divisible by 3T5 % end , index: O i=1; while i < length(A) if mod(A(i),3) == 0 index =
if i <= length(A) fprintf(The index of the first number divisible by 3 is %d\ni): end O i=1; while mod(A(i),3) -= 0 && i <=
0 0
Add a comment Improve this question Transcribed image text
Answer #1
Question 8:
Values of i in the for loop are from length(A) down to 1
This code finds the first index value that is divisible by 3.

Answer:

while mod(A(1),3) == 0 && i <= length(A) i=i+1; end ifi <= length(A) fprintf(The index of the first number divisible by 3 is

Add a comment
Know the answer?
Add Answer to:
8 0/1 point How could the following code be re-written with a while loop? % find...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT