How to calculate the volume of cylinder in Kotlin

1 Answer

0 votes
fun main() {
    val radius: Float = 12.0f
    val height: Float = 26.0f

    val pi: Float = Math.PI.toFloat()

    val cylinderVolume: Float = pi * (radius * radius) * height

    println("Cylinder volume = $cylinderVolume")
}


 
 
/*
run:
   
Cylinder volume = 11762.123
   
*/

 



answered Nov 22, 2024 by avibootz

Related questions

1 answer 104 views
1 answer 103 views
1 answer 109 views
1 answer 119 views
1 answer 135 views
1 answer 127 views
...