a: The length of an apothem of the base of the pyramid
n: The number of sides of the base of the pyramid
s: The length of a side of the base of the pyramid
h: The height of the pyramid
S: The surface area of the pyramid

In general, the volume of a pyramid is one-third the area of the base times the height of the pyramid.

The area of a regular polygon is given by the formula below:

Substitute to get the following:

Simplify to get the final result:
