Calculating the cotangent

Report a typo

Please write a simple Go program that takes as an input the value of an angle in radians, calculates its cotangent, and prints the calculated cotangent with two decimals.

Take notice that there are many ways to calculate the cotangent; below are two examples of how we can calculate the cotangent using trigonometric identities:

ctg a

cot a

Sample Input 1:

1.4142

Sample Output 1:

0.16
Write a program in Go
package main

import (
"fmt"
"math"
)

func main() {
var radians float64
fmt.Scanln(&radians)

// Please use any of the above identities to calculate the 'cotangent' below:
cotangent := ?

fmt.Printf("%.2f", cotangent)
}
___

Create a free account to access the full topic