Script Practice: For this exercise you will create a .m file (script file) to ca
ID: 3662648 • Letter: S
Question
Script Practice: For this exercise you will create a .m file (script file) to calculate the area of triangle. You will need to save your work, then run the program. The output you must show includes both your script file followed by your output that results (in the command window). Create a .m file entitled HW1SP1 (save it to a USB drive) Add comments to the top of the file using % (Name, Homework Number, Problem Number, Class Section, Date) Gain two pieces of information from the user using the input command o Ask the user to enter a height, h, for the triangle o Ask the user to enter a base, b, for the triangle Calculate the area based on h and b Display the results in the command window using the disp command Copy / paste the script file into your homework solution Run your program Copy / paste the command window output into your homework solution
Explanation / Answer
base=input('enter base');
height=input('enter height');
area=(base*height)/2;
disp(area);
Here is the code for you. If you have any further queries, just get back to me.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.