trying_out_go/toCelsius.go

19 lines
317 B
Go
Raw Normal View History

2023-10-16 12:44:08 -04:00
package main
import (
"fmt"
"log"
"git.linuxhg.com/john-okeefe/keyboard"
)
func toCelsius() {
fmt.Println("Enter a temperature in Fahrenheit: ")
fahrenheit, err := keyboard.GetFloat()
if err != nil {
log.Fatal(err)
}
celsius := (fahrenheit - 32) * 5 / 9
fmt.Printf("%0.2f degrees Celsius\n", celsius)
}