Question
MATLAB A. Write a script that will calculate and display the log of a number. The number has to be less than or equal to
MATLAB
A. Write a script that will calculate and display the log of a number. The number has to be less than or equal to 10. Your program has to start by prompting the user for a positive number that is less than or equal to 10. Your script has to handle the following: If the user enters a negative number or zero, the program will display an error message and terminate. If the user enters a number that is greater than 10, the program asks again until the user enters a value less than or equal 10. If the user enters a positive value that is less than or equal to 10, the script will calculate and display the log of the entered value. (Hint: use a while loop and a break statement)
B. Modify your script for the previous question so if the user enters a negative value, the program asks again - until the user enters a positive value. (Hint: use a while loop and a continue statement)
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