How to calculate the surface area of cuboid in Kotlin

1 Answer

0 votes
// Function to calculate the surface area of a cuboid
fun surfaceAreaCuboid(length: Double, width: Double, height: Double): Double {
    return 2 * (length * width + width * height + height * length)
}

fun main() {
    val length = 6.0
    val width = 3.0
    val height = 4.0

    val surfaceArea = surfaceAreaCuboid(length, width, height)

    println("Surface Area of Cuboid is = $surfaceArea")
}

 



answered Mar 3 by avibootz
...