TASK: Write a script that determines whether numbers X, Y, and Z could be the sides of a triangle.
COMMENT: If X, Y and Z are the lengths of the sides of a triangle, then they must satisfy all three versions of the triangle inequality:
X <= Y + Z Y <= X + Z Z <= X + YNotice that, in the instructions below, we check whether each inequality is NOT true. How do we do this? The first inequality is true if:
x is less than or equal to y + z.Therefore, the first inequality is false if:
x is greater than y + z
A user will type in three numbers, and your script must report "Numbers can form a triangle" or "Numbers cannot form a triangle".
INSTRUCTIONS:
Use the MATLAB input() command three times to get values "x", "y", and z. Define a boolean (true/false) varlable called "triangular" and give it the initial value "true". Now check all three triangle inequalities. If any one of them is not true, set "triangular" to "false". To report your result, use statements like this: if ( triangular ) fprintf ( ' X, Y, and Z can form a triangle.' ) else fprintf ( ' X, Y, and Z cannot form a triangle.' ) end
SUBMIT: Your work should be stored in a script file called "hw007.m". Your script file should begin with at least three comment lines:
% hw007.m % YOUR NAME % This script (describe what it does) % Add any comments here that you care to make.If this problem is part of an assignment, then submit it to Canvas.