add chapter 4

This commit is contained in:
Archie Fox
2025-01-30 12:01:02 +03:00
parent 36a52e353d
commit ecc1e28f0a
8 changed files with 129 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"golang-book/head-first-go/chapter4/keyboard"
"log"
)
func main() {
fmt.Print("Enter a temperature in Farenheit: ")
farenheit, err := keyboard.GetFloat()
if err != nil {
log.Fatal(err)
}
celsius := (farenheit - 32) * 5 / 9
fmt.Printf("%0.2f degrees Celsius\n", celsius)
}