Calculate the Sum of the Interior Angles From the Given Figure Using MATLAB
Question
In order to have a closed geometric figure composed of straight lines (Shown in figure), the angles in the figure must add to
(ð‘›−2)(180 ð‘‘ð‘’ð‘”ð‘Ÿð‘’ð‘’ð‘ )
Where n is the number of sides.
a) Write a program that prompts the user to enter one of the following
triangle
square
pentagon
hexagon
Use the input to define the value of n via a switch/case structure;
Then use n to calculate the sum of the interior angles in the figure.
b) Reformulate your program from part (b) so that it uses a menu.
Summary
This question belongs to MATLAB software and discusses about application of MATLAB in mathematics and to calculate the sum of the interior angles from the given figure.
