63 041
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #52513 in MatLAB | Mathematica | MathCAD | Maple for jason

Question #52513
Create a nested for-loop script to iterate through all values of i=1:20 and j=1:20. Also start with a
running tally of total=0.
At each iteration, check the value of j. If j is divisible by 3, then do nothing and proceed to the next value of j. Next, if i x j is greater than 100, then stop processing the current j-based for-loop, and move on to the next value of i.
If both conditions have not been met, then add both i and j to the running tally called total. What is your final value for total at the end of your script? And how many times did MATLAB execute the break and continue statements in your program?
Expert's answer
Answer:
 
total=0;
for i=1:10
    flagBreak=0;
    for j=1:20
        if rem(j,3)==0
            continue;
        else
            if i*j>100
                flagBreak=1;
                break;           
            else
                total=total+i+j;
            end
        end
       
    end
    if flagBreak==1
       continue;
    end
end
total
 
 
Result:
1586
 
Number of break: 5
Number of continue: 56

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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions