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 3815673

Submitted on 24 Nov 2020 by Irina Anjum Pranti
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);

y = 93.5307

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

y = 101.8234

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

y = 145.7027

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

y = 510.4984

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!