[Golang]Fahrenheit to Celcius conversion

This is an exercise of my golang course.
The purpose is to convert Fahrenheit to Celcius

package main

import "fmt"

func FtoC(f float64) (c float64){
	c = (f - 32) / 1.8
	return c
}

func main(){
	var fahrenheit float64
	fmt.Println("Enter Fahrenheit: ")
	fmt.Scanf("%f", &fahrenheit)
	celcius := FtoC(fahrenheit)
	fmt.Printf("Fahrenheit: %.2f is equal to Celcius: %.2f", fahrenheit, celcius)
}

FtoC

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s