Question: Write a Matlab script (m file) that iterates through the numbers 1 to 1000. In a 1x8 array (vector) store the count of numbers in

Write a Matlab script (m file) that iterates through the numbers 1 to 1000. In a 1x8 array (vector) store the count of numbers in the range that are divisible by the following prime numbers: 2, 3, 5,7,11, 13, 17, 23 You MUST use for loop and if (and/or elseif and/or else) statements to complete this prompt. Display the array at the end of your script. Use the display or fprintf) function to display your answer (look up how to use them!) All other statements should be suppressed! Remember to add comments as necessary so anyone can read and understand your code. Name your script ENES101_HW3_LastName_Firstlnitial.m. For example, for the range 1 through 10, the final array answer would be [5, 3, 2, 1, 0, 0, 0, 0] because there are 5 numbers divisible by 2, 3 numbers divisible by 3, 2 numbers divisible by 2, and so on. Your range will be from 1 to 1000 for this homework, though. We will run your script by calling the script name in the Command Window, and the output should look similar to: >ENES101_HW3_Doe_J divisibleByPrime [5, 3, 2,1, 0, 0, 0, 0 >7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
