Question
What is the answer, with explanation. MATLAB ASSIGNMENT
LA, dn a nested for loop, only the outer loop requires the end keyword, the inner loop does not require an end keyword. True False
0 0
Add a comment Improve this question Transcribed image text
Answer #1

in a nested for loop only the outer loop requires the end keyword , the inner loop does not require an end keyword

answer is FALSE

for i=2:100
for j=2:100
if(~mod(i,j))
break; % if factor found, not prime
end
end
if(j > (i/j))
fprintf('%d is prime\n', i);
end
end

output is

2 is prime
3 is prime
5 is prime
7 is prime
11 is prime
13 is prime
17 is prime
19 is prime
23 is prime
29 is prime
31 is prime
37 is prime
41 is prime
43 is prime
47 is prime
53 is prime
59 is prime
61 is prime
67 is prime
71 is prime
73 is prime
79 is prime
83 is prime
89 is prime
97 is prime
Add a comment
Know the answer?
Add Answer to:
What is the answer, with explanation. MATLAB ASSIGNMENT In a nested for loop, only the outer...
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