How to calculate an angle of a right triangle given opposite and hypotenuse in Go

1 Answer

0 votes
package main

import (
    "fmt"
    "math"
)

func main() {
    opposite := 2.5
    hypotenuse := 5.0

    angleSin := opposite / hypotenuse
    angleRadians := math.Asin(angleSin)
    rightTriangleAngle := angleRadians * 180 / math.Pi

    fmt.Printf("Right Triangle Angle = %.2f\n", rightTriangleAngle)
}


/*
run:
  
Right Triangle Angle = 30.00

*/

 



answered 22 hours ago by avibootz
...