trying_out_go/cmd/playground/toCelsius.go

19 lines
307 B
Go
Raw Normal View History

package main
import (
"fmt"
"log"
"trying_out_go/pkg/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)
}