How to calculate the area of a trapezoid in Swift

1 Answer

0 votes
let a:Float = 6
let b:Float = 9
let height:Float = 5
let area:Float = 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
...