Jump to content

Length of an arc between two angles: Difference between revisions

Line 123:
@show arclength(10, 10, 120) # --> arclength(10, 10, 120) = 43.63323129985823
</lang>
 
=={{header|Kotlin}}==
{{trans|Go}}
<lang scala>import kotlin.math.PI
import kotlin.math.abs
 
fun arcLength(radius: Double, angle1: Double, angle2: Double): Double {
return (360.0 - abs(angle2 - angle1)) * PI * radius / 180.0
}
 
fun main() {
val al = arcLength(10.0, 10.0, 120.0)
println("arc length: $al")
}</lang>
{{out}}
<pre>arc length: 43.63323129985823</pre>
 
=={{header|Perl}}==
1,452

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.