20 lines
372 B
Go
20 lines
372 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
var cel float64
|
|
var fah float64
|
|
|
|
func main() {
|
|
fmt.Println("Celsius to Fahrenheit converter")
|
|
fmt.Println("Write a temperature in celsius")
|
|
fmt.Scan(&cel)
|
|
celsiusToFahrenheit(cel)
|
|
fmt.Printf("%v degrees Celsius are equivallent to %v degrees Fahrenheit\n", cel, fah)
|
|
}
|
|
|
|
func celsiusToFahrenheit(cel float64) {
|
|
fah = cel*1.8 + 32
|
|
return
|
|
}
|