### Trigonometry with Go Language - Sin, Cos, Tan Functions Examples

Package math provides functions to calculate Trigonometric functions values.

Program to demonstrate how to calculate Trigonometric functions values in Go,

package main

import (
"fmt"
"math"
)

func main() {

var degrees float64

fmt.Println("Enter value of angle in degrees : ")

_, err := fmt.Scanf("%f", &degrees)

if err != nil {
fmt.Println(err)
}

//calculate the sine
s := math.Sin(degrees)
fmt.Println("The Sine of ", degrees, " degrees is : ", s)

//calculate the cosine
c := math.Cos(degrees)
fmt.Println("The Cosine of ", degrees, " degrees is : ", c)

//calculate the tan
t := math.Tan(degrees)
fmt.Println("The Tangent of ", degrees, " degrees is : ", t)

//calculate the sec
se := 1 / math.Sin(degrees)
fmt.Println("The Sec of ", degrees, " degrees is : ", se)

//calculate the cosec
co := 1 / math.Cos(degrees)
fmt.Println("The Cosec of ", degrees, " degrees is : ", co)

//calculate the cotangent
cot := 1 / math.Tan(degrees)
fmt.Println("The Cotangent of ", degrees, " degrees is : ", cot)

}

Output: