def triangular_prism_volume(base, height, length) area = 0.5 * base * height # calculate area of triangle face volume = area * length # calculate volume of triangular prism return volume # return volume value end
puts triangular_prism_volume(3, 4, 5) # output: 30.0
main.rb761 chars11 lines
gistlibby LogSnag