Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB I did a and c, just need help with b. Write code to find all numbers between 1 and 10000 (inclusive) that are multiples
MATLAB
I did a and c, just need help with b.
Write code to find all numbers between 1 and 10000 (inclusive) that are multiples of 5 or multiples of 7, but not both. Write the code three ways; all answers should be identical: a. Write this code using a for loop, looping through all integers between 1 and 10000. At each step of the loop, check if the loop index is a multiple of 5 or 7 but not a multiple of both; if it is, store it in a vector. Save your solution, which should be a row vector (1 row) of all such numbers, as x57a (2 points). b. Write this code using a while loop. Your code may be very similar, or not, either is fine. Save your solution, which should be a row vector, as x57b (1.5 point). C. Write this code without using loops. Start with x=1:10000, then use logical indexing, the find function, or some other method to identify only those elements which are multiples of 5 or 7 but not multiples of both. Save your solution, which should be a row vector (1 row) as above, as x57c (1.5 point)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started