To find the surface area of a triangular prism, we need to calculate the area of its five faces: two triangular bases and three rectangular lateral faces.
Here's the Rust code to calculate the surface area of a triangular prism:
main.rs764 chars17 lines
In this program, we define a function surface_area_of_triangular_prism
that calculates the surface area using the input values for the base and height of the triangular faces and the height of the prism. We then use this function to calculate the surface area of a triangular prism with base side lengths of 4 and 6, height of 3, and a prism height of 5.
The output of the program is:
main.rs37 chars2 lines
gistlibby LogSnag