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 159 views
1 answer 132 views
1 answer 102 views
1 answer 102 views
1 answer 119 views
1 answer 134 views
1 answer 127 views
...