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 116 views
2 answers 141 views
2 answers 135 views
2 answers 130 views
1 answer 134 views
1 answer 124 views
1 answer 232 views
...