To find the surface area of a regular polygon inscribed in a triangular prism, we need to find the area of the three sides and the area of the base.
Here's the algorithm we can use:
Here's the code in go:
main.go494 chars20 lines
Note that we use the math package to access the math functions, including square root and tangent. The output will be the surface area of the regular polygon inscribed in the triangular prism, in the appropriate units.
gistlibby LogSnag