Richard P.

asked • 04/02/24

(Geometry: area of a regular polygon)

A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon is


area = (n * s^2) / (4 * tan(PI / n))


Here, s is the length of a side. Write a program that prompts the user to enter the number of sides and their length of a regular polygon and displays its area.


Sample Run

Enter the number of sides: 5

Enter the length of a side: 6.5

The area of the polygon is 72.69017017488385

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.