logo image

Go language program to convert fahrenheit to celsius

120


Following program shows you how to convert fahrenheit to celsius. In this program we get fahrenheit temperature from user and convert that fahrenheit temperature into celsius using following formula Celsius = (fahrenheit - 32) * 5 / 9

package main

import "fmt"

func main() {

  var temperature float64
  var celsius float64
  fmt.Println("Please enter temperature in fahrenheit:")
  fmt.Scanf("%f", &temperature)
  celsius = (temperature - 32) * 5 / 9
  fmt.Println("Temperature in celsius: " , celsius)
}

Output:

Please enter temperature in fahrenheit:
 88
Temperature in celsius:  31.11111111111111