Created
September 11, 2023 15:37
-
-
Save fokosun/18e704066135accb9f5b1f8ab405c122 to your computer and use it in GitHub Desktop.
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() { | |
values := []int{10, 5, 23, 54, 99} | |
minimum, maximum := values[0], values[0] | |
for _, value := range values[1:] { | |
if value > maximum { | |
maximum = value | |
} | |
if value <= minimum { | |
minimum = value | |
} | |
} | |
fmt.Printf("Minimum value is %v\n", minimum) | |
fmt.Printf("Maximum value is %v\n", maximum) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment