To find the area of a regular polygon circumscribed around a circle, you will need to know the length of one side of the polygon, the number of sides in the polygon, and the radius of the circle.
Here's the formula to calculate the area of a regular polygon given that you have the length of the side (s) of the polygon and the number of sides (n):
main.swift53 chars2 linesAnd to find the radius of the circle, you can use the following formula, where s is the length of one side of the polygon:
main.swift44 chars2 linesPut it all together, you can write a function like this:
main.swift225 chars6 linesNow you can call this function and pass in the number of sides and length of one side of your polygon to find its area:
main.swift131 chars3 linesgistlibby LogSnag