Question
Matlab Create a script file to do the following: Using a FOR LOOP, find all integers between 1 and 100 divisible by 7 . Hint:
Matlab
Create a script file to do the following:
Using a FOR LOOP, find all integers between 1 and 100 divisible by 7. Hint: round()
Your program output should be 2 columns showing the number and an XXXX by the numbers divisible by 7. The table format should look like the sample shown below for numbers through 8. Use the fprintf command to produce text as shown below. Count the number divisible by 7 and print the total.
3. Create a script file to do the following:
a) Use the whilefunction to prompt the user to input years >=1900 and <= 2018untilthe user terminatesthe entries by entering a value of -1.
If the user enters a value outside of the acceptable range, then let user know that value is outside of range and repeat the prompt for data until a proper entry is provided or the while loop is exited with an entry of -1.
b) Calculate the mean () of user entered years (one or more entry values between 1900 and 2018).
c) After an entry of -1 and the while loop is exited, using a for loopprinteach of the validyears entered and the mean of the data.
Evaluate the program for the following input:
1907, 1908, -20, 2018, -1
Note: -20 is a number outside of the acceptable range and -1 signals terminates the input.
The output should appear as follows:
Entered data:
1907 1908 2018
The average of the years entered is 1944.3 years
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