To find the surface area of a regular polygon circumscribed around a triangular prism, we need to calculate the area of the polygon and then add the areas of the rectangular sides of the prism.
Here is some Go code to do that:
main.go842 chars27 lines
This code defines the values for the regular polygon and triangular prism, and then uses the apothem formula to calculate the apothem of the polygon. It then calculates the area of the polygon using the apothem and side length, and the area of the rectangular sides of the prism using the number of sides, side length, and height. Finally, it adds these two areas together to calculate the total surface area and prints the result.
Note that the code assumes that the polygon is circumscribed around the prism, meaning that the vertices of the polygon touch the edges of the prism.
gistlibby LogSnag