How to calculate the area of a trapezoid in Ruby

1 Answer

0 votes
a = 6
b = 9
height = 5
area = 0.5 * (a + b) * height

print "The area of a trapezoid is: ", area
   

    
    
#
# run:
# 
# The area of a trapezoid is: 37.5
#

 



answered Oct 28, 2021 by avibootz
...