How to calculate the volume of a cylinder in Scala

1 Answer

0 votes
object VolumeOfCylinder_Scala {
  def main(args: Array[String]): Unit = {
    val height = 26
    val radius = 12

    val cylinderVolume = math.Pi * (radius * radius) * height

    println(s"Cylinder volume = $cylinderVolume")
  }
}


/*
run:

Cylinder volume = 11762.122895040186

*/

 



answered Sep 26, 2024 by avibootz

Related questions

1 answer 164 views
1 answer 139 views
1 answer 111 views
1 answer 109 views
1 answer 125 views
1 answer 142 views
1 answer 132 views
...