Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The circumference of a circle is given by C-2tr where r is the radius. The circumference of an ellipse can be approximated by E Tt3(a
The circumference of a circle is given by C-2tr where r is the radius. The circumference of an ellipse can be approximated by E Tt3(a +b) - (3a + b)(a + 3b) where a and b are the minor and major axis lengths. 23a + b)(a+3b)]whereaandbare A. Write an m-file which prompts the user to specify whether they would like to calculate the circumference of a circle or an ellipse. If the circle option is chosen, ask the user for a radius. If the ellipse option is chosen, ask the user for the minor and major axis lengths. Calculate the circumference of the chosen shape. Use fprintf to write a statement containing the shape chosen, the relevant length(s) and the circumference Ask the user if they would like to repeat the calculation. If yes is chosen, go through steps A and B again. If no is chosen, end the code. B. C. Hint: Use a while loop to achieve part C Your code should look similar to the following: Enter either circle (1) or ellipse (2): 1 Enter the radius length: 1 Circle was chosen with a radius of 1. Circumference 6.283185e+00 Would you like to repeat the calculation? 1-yes, 0-no: 1
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