Skip to content

Instantly share code, notes, and snippets.

@boris
Last active August 29, 2015 14:03
Show Gist options
  • Save boris/8566704d31fc1f099f60 to your computer and use it in GitHub Desktop.
Save boris/8566704d31fc1f099f60 to your computer and use it in GitHub Desktop.
Golang exercises.

Golang Excercises

  • convert.go: convert Feet to Meters
  • temp.go: convert ºF to ªC
  • smallest.go: find the smallest number
package main
import "fmt"
func main() {
fmt.Println("Feet to meters")
fmt.Print("Inster Feets: ")
var feet float64
fmt.Scanf("%f", &feet)
M := feet * 0.3048
fmt.Println(feet, "feets are", M, "meters")
}
package main
import "fmt"
func main() {
x := []int[
48,96,86,68,
57,82,63,70,
37,34,83,27,
19,97, 9,17,
}
smallest := s[0]
for _, value := range x {
if value < smallest {
smallest = value
}
}
fmt.Println(smallest)
}
package main
import "fmt"
func main() {
fmt.Print("Insert Fahrenheit temp: ")
var fah float64
fmt.Scanf("%f", &fah)
C := (fah - 32) * 5/9
fmt.Println(C)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment