How to calculate the surface area of sphere in Scala

1 Answer

0 votes
object Main extends App {
  val radius: Double = 12.0

  val surfaceArea: Double = 4.0 * Math.PI.toFloat * (radius * radius)

  println(s"The surface area of Sphere = $surfaceArea")
}




/*
run:
  
The surface area of Sphere = 1809.5574188232422

*/

 



answered Nov 19, 2024 by avibootz

Related questions

1 answer 94 views
1 answer 100 views
1 answer 111 views
1 answer 85 views
1 answer 159 views
1 answer 115 views
...