How to calculate PI value with acos() function in Kotlin

2 Answers

0 votes
fun main() {
    val pi = Math.acos(-1.0)
    
    println("pi = $pi")
}
 
 
 
/*
run:

pi = 3.141592653589793
 
*/

 



answered Dec 20, 2024 by avibootz
0 votes
fun main() {
    val pi = 2 * Math.acos(0.0)
    
    println("pi = $pi")
}
 

 
/*
run:

pi = 3.141592653589793
 
*/

 



answered Dec 20, 2024 by avibootz

Related questions

2 answers 274 views
2 answers 285 views
2 answers 275 views
2 answers 276 views
1 answer 230 views
1 answer 241 views
1 answer 337 views
...