- convert.go: convert Feet to Meters
- temp.go: convert ºF to ªC
- smallest.go: find the smallest number
Last active
August 29, 2015 14:03
-
-
Save boris/8566704d31fc1f099f60 to your computer and use it in GitHub Desktop.
Golang exercises.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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