mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-12-01 02:28:56 +00:00
23 lines
415 B
Go
23 lines
415 B
Go
// Copyright © 2016 Alan A. A. Donovan & Brian W. Kernighan.
|
|
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
|
|
// See page 29.
|
|
//!+
|
|
|
|
// Boiling prints the boiling point of water.
|
|
package main
|
|
|
|
import "fmt"
|
|
|
|
const boilingF = 212.0
|
|
|
|
func main() {
|
|
var f = boilingF
|
|
var c = (f - 32) * 5 / 9
|
|
fmt.Printf("boiling point = %g°F or %g°C\n", f, c)
|
|
// Output:
|
|
// boiling point = 212°F or 100°C
|
|
}
|
|
|
|
//!-
|