Cody

Problem 45178. An n-sided regular polygon is drawn within a circle whose radius is 'r', what will be the area of the polygon?

Solution 2927167

Submitted on 9 Sep 2020 by Alfonso Nieto-Castanon
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
n = 6; r = 6; y_correct = 93.5307; assert(abs(poly(n,r) - y_correct) < tolerance);

2   Pass
n = 8; r = 6; y_correct = 101.8234; assert(abs(poly(n,r) - y_correct) < tolerance);

3   Pass
n = 11; r = 7; y_correct = 145.7027; assert(abs(poly(n,r) - y_correct) < tolerance);

4   Pass
n = 13; r = 13; y_correct = 510.4984; assert(abs(poly(n,r) - y_correct) < tolerance);

Suggested Problems

More from this Author149

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!