Created
May 27, 2014 05:38
-
-
Save shockalotti/42793824bf99813eb4a1 to your computer and use it in GitHub Desktop.
Go Golang - find highest and lowest number
This file contains hidden or 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, | |
} | |
min:=x[0] | |
for i:=0; i<len(x); i++ { | |
if x[i] < min { | |
min = x[i] | |
} | |
} | |
fmt.Println(min,"is the lowest number in the range") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment