Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) Write a user-defined function areaperim that will calculate both the area and perimeter of a polygon. The radius r will be passed as an

image text in transcribed
(a) Write a user-defined function areaperim that will calculate both the area and perimeter of a polygon. The radius r will be passed as an argument to the function. If a second argument is passed to the function, it represents the number of sides n. If, however, only one argument is passed, the fiction generates a random value for n (an Integer in the range from 3 to 8). For a polygon with n sides inscribed in a circle with a radius of r, the area a and perimeter p of the polygon can be found by a = 5nrsin(**) , p = 2arsin() 72 72 Vectorize your code. (b) Write a program as script file that calculate the area and perimeter of a polygon when: 1. radius r=[1 3 5); ii. radius r=7 and number of sides n-3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of International Auditing And Assurance

Authors: Rick Hayes, Philip Wallage, Peter Eimers

4th Edition

9463720065, 978-9463720069

More Books

Students also viewed these Accounting questions