Question: (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

 (a) Write a user-defined function areaperim that will calculate both the

(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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!