object CalculateVolumeSphere_Scala {
def sphereVolume(r: Double): Double = {
4.0 / 3.0 * Math.PI * Math.pow(r, 3)
}
def main(args: Array[String]): Unit = {
val radius = 5
println(s"Volume of sphere = ${sphereVolume(radius)}")
}
}
/*
run:
Volume of sphere = 523.5987755982989
*/