Contact: aviboots(AT)netvision.net.il
41,551 questions
54,171 answers
573 users
fun pentagonArea(side: Double, apothem: Double): Double = 5.0 * (side * apothem) / 2.0 fun main() { val side = 5.0 val apothem = 3.0 val area = pentagonArea(side, apothem) println("Area = %.2f".format(area)) } /* run: Area = 37.50 */
import kotlin.math.sqrt import kotlin.math.pow fun area_regular_pentagon(side: Double): Double { return (1.0 / 4.0) * sqrt(5 * (5 + 2 * sqrt(5.0))) * side.pow(2.0) } fun main() { println(area_regular_pentagon(7.0)) } /* run: 84.30339262885938 */