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 124 views
2 answers 145 views
2 answers 141 views
2 answers 144 views
1 answer 137 views
1 answer 129 views
1 answer 237 views
...